Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

GET_ACCOUNTS permission while using GCM - Why is this needed?

I have an app, with Push notifications implemented.

I want to understand the reason why we need "GET_ACCOUNTS"(android.permission.GET_ACCOUNTS), while implementing GCM? Some users are raising concerns with this permission. I have used this permission in the manifest as it was given in the official site here.

How safe is this permission? and if I remove this, from my manifest, will the push notifications work?

like image 454
Vamsi Challa Avatar asked Aug 26 '13 12:08

Vamsi Challa


People also ask

What is Get_accounts?

android.permission.GET_ACCOUNTS. Allows access to the list of accounts in the Accounts Service.

What is Call_phone permission?

Permission CALL_PHONE belong to dangerous permission group. So if your apps target SDK is 23 or higher and your device is running on Android 6.0 or higher, you must request for CALL_PHONE permission while the app is running. Example : String number = ("tel:" + numTxt.


2 Answers

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.

SO this is the reason for requirement of the permission

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

to read Google account.

Read more about this GCM Overview


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

If you are using GCM API with GoogleCloudMessaging.register), you no longer need to configure Google account on any Android version. But if you are using the deprecated library (GCMRegistrar.register), you still need a Google Account on older versions (before ICS).

More details at https://groups.google.com/forum/#!topic/android-gcm/ecG-RfH-Aso. Another similer thread is Why google Account login is required for GCM to work for devices below 4.0.4 OS?

like image 188
Pankaj Kumar Avatar answered Sep 17 '22 13:09

Pankaj Kumar


The GET_ACCOUNTS permission is no longer needed for GCM to work. It used to be required for registration to GCM, but a recent Play Services update stopped using the Google account even on Froyo and Gingerbread. If you are registering to GCM with Play Services (i.e. With GoogleCloudMessaging.register), you no longer need this permission on any Android version. If you are using the deprecated library (GCMRegistrar.register), you still need a Google Account on pre 4.0.4 version, which requires that permission.

Source (posted on android-gcm Google Group by a Google developer) :

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.

like image 25
Eran Avatar answered Sep 20 '22 13:09

Eran