Sunday, January 22, 2012

Android Market

Smartphones have become such an integral part of our lives that they've now become a matter of Pride. Let me tell you before moving a single paragraph further "if you do not have a Smartphone, chances are you may not be getting promoted easily :)"
The Android operating system for smartphones was released in 2008. Android is an open-source platform backed by Google, along with major hardware and software developers (such as Intel, HTC, ARM, Motorola and Samsung, to name a few), that form the Open Handset Alliance.[5It is developed by the Open Handset Alliance led by Google.
History:
Google purchased the initial developer of the software, Android Inc., in 2005. The unveiling of the Android distribution in 2007 was announced with the founding of the Open Handset Alliance, a consortium of 86 hardware, software, and telecommunication companies devoted to advancing open standards for mobile devices.

2011 Q2 Smartphone sales
Manufacturer: Samsung, Motorola, LG, HTC, Sony Ericsson, Acer, HTC, Dell, Huawei, ZTE, and others.
Supported Device: Smartphone, Tablet computers, E-readers, Notebooks, Other devices.
Most famous handset: The Galaxy Nexus.
Symbian is a mobile operating system (OS) and computing platform designed for smartphones and currently maintained by Accenture. Nokia announced that it would migrate away from Symbian to Windows Phone 7.In February 2011 Nokia announced a plan to make Microsoft Windows Phone its main operating system of choice for new Nokia smartphones.
Recent releases:
§  2.3 Gingerbread
§  3.0 Honeycomb
§  3.1 Honeycomb
§  3.2 Honeycomb
§  4.0 Ice Cream Sandwich:
§  October 19, 2011, brought Honeycomb features to smartphones and added new features including facial recognition unlock, network data usage monitoring and control, unified social networking contacts, photography enhancements, offline email searching, app folders, and information sharing using NFC. 
§  Android 4.0.3 Ice Cream Sandwich is the latest Android version that is available to phones. The source code of Android 4.0.1 was released on November 14, 2011.
Comon Features:
§  Handset layouts
§  Storage
§  Connectivity
§  Messaging
§  Multiple language support
§  Web browser
§  Java support
§  Media support
§  Streaming media support
§  Additional hardware support
§  Multi-touch
§  Bluetooth
§  Video calling
§  Multitasking
§  Voice based features
§  Tethering
§  Screen capture
Features:Android 4.0 Ice Cream Sandwich (ICS)
 Font system:
 
The brand new font system, which is much more appealing than previous versions. It is known as Roboto which is specially designed for high resolution screens and brings a magazine-like feel to the whole interface.
Screenshots:
 
Android smartphone will allow us to take screenshots without rooting the smartphone or installing any third-party apps. Just hold down the volume down key and the power button to capture the screen.
Instant voice:

 
While this is not as compelling as Siri on iPhone, unlike other versions of Android which support voice commands, Android 4.0 will not take very long to transcribe your words. Just speak it in and it instantly transforms it into text.

Android Beam:

 

This features is based on NFC (Near Field Communication) and it allows two Android smartphones to securely exchange Web pages, contacts, media or even applications. It is based on NDEF Push technology.

Unified tablet and smartphone API:

 


Unlike Android Honeycomb, Android 4.0 ICS will work on tablets as well as smartphones, making it simple for developers to create one application and have it work on various form factors. This will surely imp.
  
Web browser:

 

The new version comes with a brand new Chrome mobile Web browser. It syncs with your desktop or laptop Chrome bookmarks, it can save pages for offline reading, and it can open upto 16 tabs at the same time.

Improved camera:

 

Android ICS has some great new camera features, a brand new camera UI, options to edit your images using multiple effects right after you click them and it captures images at a ridiculously fast speeds, probably the fastest amongst smartphones. Video recording modes have also improved along with support for a time lapse mode.
Why Google’s Android phones are better than the iPhone?
§  Android is cheaper.
§  Quality wise iphone still rocks.
§  Android development is easier. But the more you go in deep you may need to a lot of work to develop a well suited functionality. In Iphone you need to write lesser lines of code.
§  Google is currently winning the race for the smartphone market share.
§  Apple leads Android in the apps market, with the Apple Store having 18 billion downloads, while Android has just reached 10 billion downloads in the Android Marketplace
§  Without the monopoly of one company, Apple. The ability to run tens of thousands of apps just like the iPhone but with choice of phone models that you can choose from.
§  The app developers still choose iOS first for launching any app because they see more profit potential. According to Pipar Jaffray, a U.S. investment banking firm, Android developers earn just 7% of what iOS Apple Store earns for its developers.
§  Apple’s App Store has earned about $4.9 billion in gross revenue for paid apps, while the Android Marketplace is estimated to have earned just $330 million in that market. Apple is beating Android in this area, primarily because of its overwhelming success in the paid apps market.
§  Google fully developed Android and make it into an Open Source. Now, any phone manufacturer can use Android without expensive license fee from Google. Because it is Open, manufacturer can modify Android without restriction, allowing it to fit the device they are making - total freedom.
Now the questions are... shouldn’t we go with Android then....?Am I promoting Android..?

Sunday, January 1, 2012

Jersey - JSON output format from


 

How to control JSON output format from Jersey?


 
As you know that in XML you can represent the same data in variety of ways by using fields, names, attributes, etc..The same is true to JSON. In many cases different serializers produce different JSON representation of the same objects.
JAX-RS (as well as Jersey) provide you control over what and how you want to serialize. This is accomplished via providers.
Here is an example of such provider (Note that the class should be marked with @Provider annotation):
@Provider
public class JAXBContextResolver implements ContextResolver<JAXBContext> { 
    private JAXBContext context;
    private Class<?>[] types = { ListDescription.class }; 
 
    public JAXBContextResolver() throws Exception {
        JSONConfiguration config = JSONConfiguration.natural().build();
        context = new JSONJAXBContext(config, types);
    } 
 
    public JAXBContext getContext(Class<?> objectType) {
        for (Class<?> type : types) {
            if (type == objectType) {
                return context;
            }
        }
        return null;
    }
}
Note that by creating an appropriate JSONConfiguration (JSONConfiguration.natural().build()) you, in fact, control the output JSON format. The JSONConfiguration class provide 4 different JSON formatters:
  1. natural (Jackson)
  2. mapped
  3. mappedJettison
  4. Badgerfish
Here is how the output will vary, depending on the choice of the configuration. Don’t forget that the class should be annotated with A simple class (with fields (int)ID and (String)Name) added to an ArrayList and then returned back as a @GET return value:
@XmlRootElement
public class ListDescription{
        public int ID;
        public String Name;
}
@GET
@Produces({MediaType.APPLICATION_JSON })
public List<DataListInfo> getAllLists(){
        List<ListDescription> lists = new ArrayList<ListDescription>();
        ListDescription ls = new ListDescription();
        ls.ID = 1;
        ls.Name = "Test";
        lists.add(ls);
        return lists;
}
mappedJettison:

{"listDescriptions":{"listDescription":{"ID":1,"Name":"Test"}}}
mapped:

{"listDescription":{"ID":"1","Name":"Test"}}
natural (jackson):
1
[{"ID":1,"Name":"Test"}]
Badgerfish:

{"listDescriptions":{"listDescription":{"ID":{"$":"1"},"Name":{"$":"Test"}}}}