Tuesday, October 26, 2010

Developing / Testing Android applications for MOTOROLA Handsets

Motorola provides lot of supporting tools for developin applications for their android handsets.

They provides more development tools and resources such as SDK Add-ons for targeting Motorola handsets, useful libraries, and sample source code.

visit this link for more information:

http://developer.motorola.com/docstools/

for more Additional Tools & Resources

http://developer.motorola.com/docstools/tools/

You can download SDK's and handset emulators and sample codes .
for installation of SDK addon's
goto this link

http://developer.motorola.com/docstools/library/Installing_the_Motorola_SDK_Add-on/

have a happy development.





Developing Android applications for Samsung GALAXY Tablet

Suppose,you are writing an application which is targeted to SAMSUNG GALAXY TABLET version,unfortunately you don't have a real device.

Developing for Samsung GALAXY Tab is no different from developing for any other Android based device. By utilizing only public APIs provided in the Android SDK and follow the guidelines and tips below, applications will not just work on the GALAXY Tab but also scale correctly.


If you test the application in android 2.2 emulator it was not perfect and if you run the same in real device,you will unexpected results.

In this case,you can test in ORIGINAL samsung galaxy tablet emulator which is avaliable in SAMSUNG developer portal.

It is with a 7” device and a screen resolution of 1024x600 the Samsung GALAXY Tab provides a perfect form factor to optimize applications, by implementing UI and UX enhancements previously not possible.
   
Samsung GALAXY Tab Add-on Installation Guidelines

1) Run AVD Manager on Eclipse IDE.


2) Select Available Packages in the left panel of AVD Manager.


3) Click “Add ADD-on Site” and enter the URL below.


4) Check Samsung GALAXY Tab Add-on packages and click install button.


5) Check Samsung GALAXY Tab Add-on license & Click install button.


6) After downloading and installation of GALAXY Tab Add-on, you should restart ADB (Android Debug Bridge) or Eclipse. 


Now,you can see the installed addon in Installed Packages of AVD manager and in list of targets available.


You can create samsung galaxy tablet emulator by selecting  samsung galaxy as Target device.

And output is as shown below:


Quick Guide Tips:

Samsung GALAXY Tab is a 7” inch device with 1024x600(WSVGA) resolution running Android 2.2 (Froyo). The following guidelines will help developers optimize applications for the best possible user experience.

Make sure that high density display (HDPI) resources are in the application package, as the tablet display requires these resources. Most Android devices are API level 4 or greater. We recommend porting over our application with minSDKVersion=4 or greater. This allows you to add HPDI resources in the application package. If the system cannot find the HPDI resources and android:anyDensity=”true” 

has been set, the existing resources will be scaled which may not give the user the best experience.

The following are values are default for the Samsung Android Tablet:

DeviceMetrics.density = 240
DeviceMetrics.xdpi = 168
DeviceMetrics.ydpi = 168
The density system property value has been set as
[ro.sf.lcd_density]:[240]

When using bitmap resources like advertisement banners, work with your ad vendor to get the correct banner size. Scale the bitmap programmatically by getting the device height and width at runtime as follows:

WindowManager mWMgr =
(WindowManager)context.getSystemService(Context.WINDOW_SERVICE);
int width = mWMgr.getDefaultDisplay().getWidth();
int height - mWMgr.getDefaultDisplay().getHeight(); 

Android Market filters out applications based on the values specified in the AndroidManifest.xml file. The 7” inch tablet is a “large” screen.
    So, for applications which have minSDKVersion=3, define support-screens tag explicitly as:
 

  Follow the recommended generic compatibility guidelines, such as:
- In XML layout, Use wrap_content, fill_parent
- Use FrameLayout instead of AbsoluteLayout
- NEVER use hard-coding for pixel value, use dip (density independent pixel)
- Use resources according to each density, resolution category.
 
 

Copying Larger database files in ANDROID Application

If you are trying to import or copy an already existing database ( More than 1Mb in size) file to your application then you will certainly get the following error when you are trying to copy the database.

D/asset (909): Data exceeds UNCOMPRESS_DATA_MAX (1424000 vs 1048576) 
 
Due to the fact that there is a file size limit (upto 1 MB) on resources in the raw or assets folders.
 
Finally it indicates that you can not copy the file which is >1 MB into your application at runtime.
 
I faced this problem when i need to import an 1.5 MB database file into application.
I solved in the following way.
 
1) Split the files.  I used the linux split command to split the binary database file 
into a maximum of 1048576 bytes. 
 
The command is:
split inputfile -b 1048576 outfileprefix 
and the files come out as outfileprefixaa, outfileprefixab, etc.  

2)Copy these files into my raw resource folder and set up my code to 
create and then close a database automatically using SQLiteOpenHelper 
and then to run the following method: 
 
 private void copyDatabase() throws IOException{
       
        OutputStream databaseOutputStream = new 
FileOutputStream("/data/data/com.domain.app/databases/app.db");
         InputStream databaseInputStream;
       
        byte[] buffer = new byte[1024];
        int length;
       
        databaseInputStream = 
databaseOpenHelperContext.getResources().openRawResource(R.raw.datafileaa);
        while ( (length = databaseInputStream.read(buffer)) > 0 ) {
            databaseOutputStream.write(buffer);
        }
        databaseInputStream.close();
       
        databaseInputStream = 
databaseOpenHelperContext.getResources().openRawResource(R.raw.datafileab);
        while ( (length = databaseInputStream.read(buffer)) > 0 ) {
            databaseOutputStream.write(buffer);
        }
        databaseInputStream .close();        
        databaseOutputStream.flush();
        databaseOutputStream.close();
    } 
This solution works perfectly.  And it's very fast.  My final database 
size on the emulator is 1424000 bytes (about 1.5 MB).  It copies almost 
instantly.  There is no delay when the application first runs.  However, 
remember that the resource files remain installed, and you've copied the 
data to a database. 
 
Good luck to all you database pre-populators and I hope this helps.  I 
welcome any input and correction to this document as I am no expert and 
may be doing something that isn't kosher in my code. 

By this we can copy a larger file into application database.


 
 
 
 

Android Developers Blog

Ram's shared items