鸟语天空
静态注册Receiver
post by:追风剑情 2016-1-8 15:19

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

示例: 静态注册GCM Broacase Receiver


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


评论:
发表评论:
昵称

邮件地址 (选填)

个人主页 (选填)

内容