开发者

How to make sure my Android app works on all/most phones?

So I built this Android app and it works well on my DroidX, published it and all. Now I get reports that it crashes on some phones, does strange things on others, etc. Yesterday I installed it on my friends phone and he does not receive C2DM notifications from my server and the device seem to registered with the Google's servers, got the token but it simply does not work.

Obviously there are dozens of Android phones on the market, and plenty of hardware makers. To add to that each carrier does additional changes to the Android OS when they put on device. So there are endless versions to be tested against.

How does one make sure that the app runs on most phones? I cannot buy开发者_Go百科 all of them and test, it's absurd. So what do others do?


Big companies buy various devices and test with each. Us small guys...use error reports (either from the Marketplace or sent through the app itself) to try to debug the issues.

What version of Android is your friend running? It has to run 2.2 to support C2DM.


To make sure that it does not have any problem related to size difference see this post extract:

On Android we can use screen size selector, introduced from Android 3.2, to define which layout to use. More details available at http://android-developers.blogspot.in/2011/07/new-tools-for-managing-screen-sizes.html. Following code snippet has been extracted from the same link :

public class MyActivity extends Activity 
{
    @Override protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate();
        Configuration config = getResources().getConfiguration();
        if (config.smallestScreenWidthDp >= 600) 
        {
            setContentView(R.layout.main_activity_tablet);
        } 
        else 
        {
            setContentView(R.layout.main_activity);
        }
    }
}

Another good reference for size configuration is keeping separator. This is explain in details at : http://www.vanteon.com/downloads/Scaling_Android_Apps_White_Paper.pdf

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜