静态注册Receiver

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

所谓静态注册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>


标签: Android

Powered by emlog  蜀ICP备18021003号-1   sitemap

川公网安备 51019002001593号