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.
我想了解为什么我们需要“GET_ACCOUNTS”(android.permission.GET_ACCOUNTS),同时实现GCM?一些用户对此权限提出了疑虑。我在清单中使用了此权限,因为它是在官方网站上给出的。
How safe is this permission? and if I remove this, from my manifest, will the push notifications work?
这个许可有多安全?如果我从我的清单中删除它,那么推送通知是否有效?
6 个解决方案
#1
59
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.
它使用现有的Google服务连接。对于3.0之前的设备,这需要用户在其移动设备上设置自己的Google帐户。运行Android 4.0.4或更高版本的设备不需要Google帐户。
SO this is the reason for requirement of the permission
所以这是需要许可的原因
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
to read Google account.
阅读Google帐户。
Read more about this GCM Overview
阅读有关此GCM概述的更多信息
Google account login is no longer needed for GCM to work. So you no need the android.permission.GET_ACCOUNTS
permission.
GCM无法再使用Google帐户登录。所以你不需要android.permission.GET_ACCOUNTS权限。
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).
如果您将GCM API与GoogleCloudMessaging.register一起使用),则不再需要在任何Android版本上配置Google帐户。但是,如果您使用的是已弃用的库(GCMRegistrar.register),则旧版本(ICS之前)仍需要Google帐户。
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?
有关详细信息,请访问https://groups.google.com/forum/#!topic/android-gcm/ecG-RfH-Aso。另一个similer线程是为什么GCM需要谷歌帐户登录才能用于低于4.0.4 OS的设备?
#2
12
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.
GCM不再需要GET_ACCOUNTS权限。曾经需要注册GCM,但最近的Play服务更新停止使用Google帐户,即使是在Froyo和Gingerbread上也是如此。如果您使用Play服务注册GCM(即使用GoogleCloudMessaging.register),则不再需要此任何Android版本的此权限。如果您使用的是已弃用的库(GCMRegistrar.register),则仍需要4.0.4之前版本的Google帐户,这需要该权限。
Source (posted on android-gcm Google Group by a Google developer) :
来源(由Google开发人员发布在android-gcm Google Group上):
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.
Froyo和Gingerbread注册在GoogleServicesFramework中实施,使用Google帐户进行注册。这导致了帐户未处于良好状态的人员的许多身份验证错误。
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.
从ICS开始,GCM不依赖或使用Google帐户 - 您可以在添加帐户或没有任何帐户之前使用它。
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.
“Play服务”更新正在所有设备上实施新方案 - 但似乎少数设备存在问题,我们正在调查 - 但数量远低于旧方案的数字。
#3
6
As everyone else here has said, GET_ACCOUNT
is needed for android devices lower than 4.0.4.
正如这里的其他人所说,Android设备低于4.0.4需要GET_ACCOUNT。
If you are like me and have installed a library that automatically adds this permission but you do not need it to, you can tell the AndroidManifest
to remove the permission by adding the permission to with the tools:node="remove"
attribute like so:
如果你像我一样安装了一个自动添加此权限的库但你不需要它,你可以告诉AndroidManifest删除权限,方法是添加工具:node =“remove”属性,如下所示:
In your AndroidManifest.xml
file, make sure the xmlns:tools
attribute it defined in your manifest
tag and then add the permission with remove
set:
在AndroidManifest.xml文件中,确保它在清单标记中定义的xmlns:tools属性,然后使用remove set添加权限:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
...>
...
<uses-permission android:name="android.permission.GET_ACCOUNTS" tools:node="remove" />
...
</manifest>
Word or warning that this never actually works for me but I know it has worked for others. If you can see what I might be doing wrong or have any more info about it, please comment!
或者警告,这对我来说实际上并不适用,但我知道它对其他人有效。如果您可以看到我可能做错了或有任何更多信息,请评论!
*Edit: There is a bug report open to get this feature working: https://bugzilla.xamarin.com/show_bug.cgi?id=48153
*编辑:有一个错误报告打开以使此功能正常工作:https://bugzilla.xamarin.com/show_bug.cgi?id = 48153
#4
3
when you use
当你使用
compile 'com.google.android.gms:play-services:7.5.0' add the build.gradle file means GET_ACCOUNT permission added automatically.
编译'com.google.android.gms:play-services:7.5.0'添加build.gradle文件意味着自动添加GET_ACCOUNT权限。
- forexample if developer have to use only admob in project means only specify this permission in build.gradle file compile 'com.google.android.gms:play-services-ads:7.5.0' if have any another clarification see this link https://developers.google.com/android/guides/setup
- 例如,如果开发人员必须在项目中仅使用admob,则只在build.gradle文件中指定此权限编译'com.google.android.gms:play-services-ads:7.5.0'如果有任何其他说明,请参阅此链接https: //developers.google.com/android/guides/setup
#5
1
I don't think this is actually the case. I tested it on a freshly factory reset Gingerbread device with a new Gmail account and I could receive GCM messages just fine without that permission. So the documentation is WRONG.
我认为事实并非如此。我在新的工厂重置姜饼设备上使用新的Gmail帐户对其进行了测试,我可以在没有该许可的情况下接收GCM消息。所以文档错了。
#6
0
GET_ACCOUNT is to verify if user synced Google account in mobile, and generate the key value for each user(each Google account). This is required if the device is running a version lower than Android 4.0.4.
GET_ACCOUNT用于验证用户是否在移动设备中同步了Google帐户,并为每个用户(每个Google帐户)生成密钥值。如果设备运行的版本低于Android 4.0.4,则需要此选项。
#1
59
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.
它使用现有的Google服务连接。对于3.0之前的设备,这需要用户在其移动设备上设置自己的Google帐户。运行Android 4.0.4或更高版本的设备不需要Google帐户。
SO this is the reason for requirement of the permission
所以这是需要许可的原因
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
to read Google account.
阅读Google帐户。
Read more about this GCM Overview
阅读有关此GCM概述的更多信息
Google account login is no longer needed for GCM to work. So you no need the android.permission.GET_ACCOUNTS
permission.
GCM无法再使用Google帐户登录。所以你不需要android.permission.GET_ACCOUNTS权限。
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).
如果您将GCM API与GoogleCloudMessaging.register一起使用),则不再需要在任何Android版本上配置Google帐户。但是,如果您使用的是已弃用的库(GCMRegistrar.register),则旧版本(ICS之前)仍需要Google帐户。
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?
有关详细信息,请访问https://groups.google.com/forum/#!topic/android-gcm/ecG-RfH-Aso。另一个similer线程是为什么GCM需要谷歌帐户登录才能用于低于4.0.4 OS的设备?
#2
12
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.
GCM不再需要GET_ACCOUNTS权限。曾经需要注册GCM,但最近的Play服务更新停止使用Google帐户,即使是在Froyo和Gingerbread上也是如此。如果您使用Play服务注册GCM(即使用GoogleCloudMessaging.register),则不再需要此任何Android版本的此权限。如果您使用的是已弃用的库(GCMRegistrar.register),则仍需要4.0.4之前版本的Google帐户,这需要该权限。
Source (posted on android-gcm Google Group by a Google developer) :
来源(由Google开发人员发布在android-gcm Google Group上):
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.
Froyo和Gingerbread注册在GoogleServicesFramework中实施,使用Google帐户进行注册。这导致了帐户未处于良好状态的人员的许多身份验证错误。
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.
从ICS开始,GCM不依赖或使用Google帐户 - 您可以在添加帐户或没有任何帐户之前使用它。
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.
“Play服务”更新正在所有设备上实施新方案 - 但似乎少数设备存在问题,我们正在调查 - 但数量远低于旧方案的数字。
#3
6
As everyone else here has said, GET_ACCOUNT
is needed for android devices lower than 4.0.4.
正如这里的其他人所说,Android设备低于4.0.4需要GET_ACCOUNT。
If you are like me and have installed a library that automatically adds this permission but you do not need it to, you can tell the AndroidManifest
to remove the permission by adding the permission to with the tools:node="remove"
attribute like so:
如果你像我一样安装了一个自动添加此权限的库但你不需要它,你可以告诉AndroidManifest删除权限,方法是添加工具:node =“remove”属性,如下所示:
In your AndroidManifest.xml
file, make sure the xmlns:tools
attribute it defined in your manifest
tag and then add the permission with remove
set:
在AndroidManifest.xml文件中,确保它在清单标记中定义的xmlns:tools属性,然后使用remove set添加权限:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
...>
...
<uses-permission android:name="android.permission.GET_ACCOUNTS" tools:node="remove" />
...
</manifest>
Word or warning that this never actually works for me but I know it has worked for others. If you can see what I might be doing wrong or have any more info about it, please comment!
或者警告,这对我来说实际上并不适用,但我知道它对其他人有效。如果您可以看到我可能做错了或有任何更多信息,请评论!
*Edit: There is a bug report open to get this feature working: https://bugzilla.xamarin.com/show_bug.cgi?id=48153
*编辑:有一个错误报告打开以使此功能正常工作:https://bugzilla.xamarin.com/show_bug.cgi?id = 48153
#4
3
when you use
当你使用
compile 'com.google.android.gms:play-services:7.5.0' add the build.gradle file means GET_ACCOUNT permission added automatically.
编译'com.google.android.gms:play-services:7.5.0'添加build.gradle文件意味着自动添加GET_ACCOUNT权限。
- forexample if developer have to use only admob in project means only specify this permission in build.gradle file compile 'com.google.android.gms:play-services-ads:7.5.0' if have any another clarification see this link https://developers.google.com/android/guides/setup
- 例如,如果开发人员必须在项目中仅使用admob,则只在build.gradle文件中指定此权限编译'com.google.android.gms:play-services-ads:7.5.0'如果有任何其他说明,请参阅此链接https: //developers.google.com/android/guides/setup
#5
1
I don't think this is actually the case. I tested it on a freshly factory reset Gingerbread device with a new Gmail account and I could receive GCM messages just fine without that permission. So the documentation is WRONG.
我认为事实并非如此。我在新的工厂重置姜饼设备上使用新的Gmail帐户对其进行了测试,我可以在没有该许可的情况下接收GCM消息。所以文档错了。
#6
0
GET_ACCOUNT is to verify if user synced Google account in mobile, and generate the key value for each user(each Google account). This is required if the device is running a version lower than Android 4.0.4.
GET_ACCOUNT用于验证用户是否在移动设备中同步了Google帐户,并为每个用户(每个Google帐户)生成密钥值。如果设备运行的版本低于Android 4.0.4,则需要此选项。