Is Google Account required for GCM (Google Cloud Messaging)?

拟墨画扇 提交于 2020-01-12 19:26:13

问题


I need to write a simple app to get PUSH Notifications.
I used GCM which uses Google Play Services to get information.

My questions is - to access GCM, is Google Account required or not?
Can i use another email account to identify device?
Is there any other way to get push notification for another email account or device?


回答1:


Quoting from GCM Characteristics

It uses an existing connection for Google services. For pre-3.0 devices, this requires users to set up their Google account on their mobile devices. A Google account is not a requirement on devices running Android 4.0.4 or higher.

If your app is supporting pre-3.0 devices, so yes, Google Account is required and you need to add this permission to your manifest

<uses-permission android:name="android.permission.GET_ACCOUNTS" />



回答2:


As stated in other answers, the GCM documentation states that a Google Account is required on the device for Android versions older than 4.0.4.

However, in the following post from the android-gcm Google group, a Google developer claims that if you are using the latest version of Google Play Services, you don't need a Google Account on the device even for older devices (Froyo and Gingerbread).

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.

I haven't tested it, so I can't say if it actually works.




回答3:


Yes whenever you need to use GCM Google account is required.

Because when you have logged in your account at that time Sender_Id and Application_Id in your url browser. So you will get it through Google Developer Console and use in your application.




回答4:


Yes, Google account is required.You need to obtain Sender_Id and Application_Id form Google Developer Console by logging into your Google account.




回答5:


Google account login is no longer needed for GCM to work. So you no need the android.permission.GET_ACCOUNTS permission.

If you are using GCM API with InstanceID (GCM 3.0) or GoogleCloudMessaging.register(GCM 2.0) then there is no need to configure Google account on any Android version and no need to give android.permission.GET_ACCOUNTS Permission.

But if you are using the deprecated library GCMRegistrar.register, you still need a Google Account on older versions



来源:https://stackoverflow.com/questions/22605907/is-google-account-required-for-gcm-google-cloud-messaging

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!