Friday, 3 May 2013

How to Create an application for both tablet and mobile in android

There are so many thing is to consider while Making app for tablets and mobile, here is configuration setting for Application.
-Images for Various Resolution Screens Visit:  Support screens.

1.Developing app for Mobile.

if your application is compatible with only small and normal screens, regardless of screen density, then you must specify eight different <screen> elements, because each screen size has four density configurations. You must declare each one of these; any combination of size and density that you do not specify is considered a screen configuration with which your application is not compatible. Here's what the manifest entry looks like if your application is compatible with only small and normal screens:
<manifest ... >
    <uses-sdk android:minSdkVersion="4" />
    <uses-sdk android:maxSdkVersion="10" />
   <application ... ><application>
</manifest>


The <compatible-screens> element must contain one or more <screen> elements, which each specify a screen configuration with which your application is compatible, using both the android:screenSize andandroid:screenDensity attributes. Each <screen> element must include both attributes to specify an individual screen configuration—if either attribute is missing, then the element is invalid (external services such as Google Play will ignore it).

<manifest ... >
    <compatible-screens>
        <!-- all small size screens -->
<screen android:screenSize="small" android:screenDensity="ldpi" />
<screen android:screenSize="small" android:screenDensity="mdpi" />
<screen android:screenSize="small" android:screenDensity="hdpi" />
<screen android:screenSize="small" android:screenDensity="xhdpi" />
<!-- all normal size screens -->
<screen android:screenSize="normal" android:screenDensity="ldpi" />
<screen android:screenSize="normal" android:screenDensity="mdpi" />
<screen android:screenSize="normal" android:screenDensity="hdpi" />
<screen android:screenSize="normal" android:screenDensity="xhdpi" />
</compatible-screens>    <application ... >    <application>
</manifest>

2.Developing app for Tablets.

2.1 Declare the minimum system version.
The first thing to do when you upgrade or create a project for Android 3.0 is set your manifest's android:minSdkVersion to"11". This declares that your application uses APIs available in Android 3.0 and greater, so it should not be available to devices running an older version of Android. For example:
<manifest ... >
    <uses-sdk android:minSdkVersion="11" />
    <application ... >..
    <application>
</manifest>
 
if you want your application to be available only to extra large screens, you can declare the element in your manifest like this:
<manifest ... >  ...
    <supports-screens android:smallScreens="false"
                      android:normalScreens="false"
                      android:largeScreens="false"
                      android:xlargeScreens="true" />
    <application ... >...
    <application>
</manifest>
2.2 Enable hardware acceleration.
Android 3.0 adds a hardware-accelerated OpenGL renderer that gives a performance boost to most 2Dgraphics operations.You can enable hardware-accelerated rendering in your application by settingandroid:hardwareAccelerated="true" in your manifest's <application> element or for individual<activity> elements. Hardware acceleration results in smoother animations, smoother scrolling, and overall better performance and response to user interaction. When enabled, be sure that you thoroughly test.your application on a device that supports hardware acceleration.
2.3 Using telephony or other variable features.
Tablets and similar devices might not include support for telephony, so they can't make traditional phone calls or handle SMS. Some devices might also omit other hardware features, such as Bluetooth. If your application uses these features, then your manifest file probably already includes (or should include) a declaration of the feature with the <uses-feature> element. Doing so prevents devices that do not declare support for the feature from downloading your applications. For example:
<uses-feature android:name="android.hardware.telephony" />
By default, this declares that your application requires telephony features.So, external services such as Google Play use this information to filter your application from devices that do not offer telephony.If, however, your application uses, but does not require the feature, you should add to this element,android:required="false". 
For example:
<uses-feature android:name="android.hardware.telephony" android:required="false" />
<uses-feature android:name="android.hardware.camera" android:required="false" /> <uses-feature android:name="android.hardware.bluetooth" android:required="false" />
This indicates that your application uses the feature,but is still functional if the feature
is not available. So,it should still be available to devices that don't provide telephony hardware (or telephony features), such as tablets.Then in your application code,you 
must gracefully disable the features that use telephony when it's not available.
Then in your application code, you must gracefully disable the features that use telephony when it's not available. You can check whether the feature is available using PackageManager.hasSystemFeature(). For example:
PackageManager pm = getPackageManager();
boolean hasTelephony = pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY);
I will be happy if you will provide your feedback or follow this blog. Any suggestion and help will be appreciated.
Thank you :)