在Google Cloud Messaging(GCM)中,需要在AndroidManifest文件中添加下面的权限声明,小米推送和个推也有类似的做法,有什么原理吗?
code from cloud-messaging/android/client#manifest
<permission android:name="<your-package-name>.permission.C2D_MESSAGE" android:protectionLevel="signature" />
<uses-permission android:name="<your-package-name>.permission.C2D_MESSAGE" />
Won’t gcm hit a wall in China? How do you use it
These permissions are custom permissions for the security of mutual access calls between applications. Application A defines permission statement
permission
,应用B想和应用A交互,得声明使用A声明的特定权限,即uses-permission
。android:protectionLevel="signature"
which means that while it has permission, the applications that access each other must have the same application signature to access each other.