How come a GCM permission isn't granted on Android 6?

感情迁移 提交于 2019-12-05 11:36:20
GreyBeardedGeek

The documentation, which was updated in October of 2015, still indicates that you need the signature permission.

See also Not receiving push notifications from GCM (Android)

As @CommonsWare mentioned, this does not appear to be part of the new runtime permission checking, or at least is not considered a "dangerous" permission, and so should be automatically granted.

ok, I'm not sure why it is this way, but the permission is said to be granted only if :

  1. The package name of the app is its prefix
  2. you also declare the permission, as such:

    <permission
       android:name="com.example.user.androidmtest.permission.C2D_MESSAGE"
        android:protectionLevel="signature"/>
    

The weird thing is that even though the code said that the permission is not granted when not adding the package name, it worked on the app.

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