静态注册Receiver

作者:追风剑情 发布于:2016-1-8 15:19 分类:Android

所谓静态注册Receiver,就是指在AndroidManifest.xml中配置。这样做的好处是app无需启动也能接收到广播消息。

示例: 静态注册GCM Broacase Receiver


  1. <!-- IGAWorks GCM Broacase Receiver -->
  2. <receiver
  3. //指定一个继承了android.content.BroadcastReceiver的类
  4. android:name="com.igaworks.liveops.pushservice.LiveOpsGCMBroadcastReceiver"
  5. android:permission="com.google.android.c2dm.permission.SEND" >
  6. <intent-filter>
  7. <action android:name="com.google.android.c2dm.intent.RECEIVE" />
  8. <action android:name="com.google.android.c2dm.intent.REGISTRATION" />
  9. //指定包名
  10. <category android:name="com.gameade.SGMS.kakao.onestore" />
  11. </intent-filter>
  12. </receiver>


标签: Android

Powered by emlog  蜀ICP备18021003号-1   sitemap

川公网安备 51019002001593号