简体   繁体   中英

Handling a device without GCM

I am new to android programming. My app runs the push notifications from GCM. I'm testing it on multiple devices. On one tablet that I have, it throws the exception Device does not have package com.google.android.gsf Now I know how to fix this on android emulator, as it is posted here .

My question is as an app developer how do I handle this, if the person using the app does not have com.google.android.gsf? What exactly does this mean? Do they have to have a google account setup in their phone? What about all the people that use yahoo or hotmail?

A Google Account used to be mandatory for GCM registration on pre 4.0.4 Android versions. That is not the case anymore.

If your app uses Google Play Services to register to GCM, you no longer need a Google Account, regardless of the Android version. If you are using the old client library (which contains the GCMRegistrar class), you still need a Google Account.

Here's what an Google developer wrote about it (taken from here ) :

Some background: Froyo and Gingerbread registration is implemented in GoogleServicesFramework, using the Google account for registration. This has resulted in a lot of auth errors for people where the account was not in a good state.

Starting with ICS, GCM doesn't depend or uses the Google account - you can use it before you add an account or without any accounts.

The "Play Services" update is implementing the new scheme on all devices - but it seems a small number of devices have problems with this, we're investigating - but the numbers are far lower than those with the old scheme.

If you want to use the code in GSF, for Froyo and Gingerbread - you need to use the previous library, which sets package name explicitly. The new library in GCM is using the new registration code.

The actual connection to google is following the same path - we're gradually (and slowly) moving devices to the new code in play services.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM