Vamsi Challa Vamsi Challa - 6 months ago 187
Android Question

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?

Answer

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 no 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?

Comments