Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Cloud Message and Android version

I am planning to implement Google Cloud Messaging in in my app which only runs with Android 2.2 and above.This includes modifying the Manifest file.

If my app is to run at Android 2.1, it immediately shows a force close dialog. May I know how do stop this from happening?

Currently possible solutions:

  1. Maintain 2 different version of apk in Google Play Publisher (I haven't tried this, but it seems to have more works)
  2. Use GCM alternative?

I wish my App can support Android 2.1 onwards, and only show a warning message to user e.g "to use this feature you have get Android 2.2 and above" in particular Activity that runs GCM.

like image 822
neobie Avatar asked Aug 21 '26 09:08

neobie


1 Answers

If your app can function without GCM as well, then you should register for GCM only if version is 2.2 or higher. I guess the following lines are throwing exception in "fail-fast" manner.

GCMRegistrar.checkDevice(this);
GCMRegistrar.checkManifest(this);

Disclaimer: I haven't tried it.

like image 133
Sangharsh Avatar answered Aug 22 '26 23:08

Sangharsh