Fix crash on application startup if the Google APIs are not available.

The Google APIs are not available on x86 emulator and so the application
was crashing.
This commit is contained in:
Ghislain MARY 2012-11-16 14:05:21 +01:00
parent 9885d993b3
commit 549695216c

View file

@ -42,6 +42,7 @@ public class ApiEightPlus {
public static void initPushNotificationService(Context context) { public static void initPushNotificationService(Context context) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
try {
// Starting the push notification service // Starting the push notification service
GCMRegistrar.checkDevice(context); GCMRegistrar.checkDevice(context);
GCMRegistrar.checkManifest(context); GCMRegistrar.checkManifest(context);
@ -62,5 +63,8 @@ public class ApiEightPlus {
editor.putString(context.getString(R.string.push_reg_id_key), regId); editor.putString(context.getString(R.string.push_reg_id_key), regId);
editor.commit(); editor.commit();
} }
} catch (java.lang.UnsupportedOperationException e) {
Log.i("Push Notification not activated");
}
} }
} }