友盟消息推送和更新XML配置
1 <receiver 2 android:name="com.umeng.message.NotificationProxyBroadcastReceiver" 3 android:exported="false" > 4 </receiver> 5 6 <receiver 7 android:name="com.umeng.message.RegistrationReceiver" > 8 <intent-filter> 9 <action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> 10 </intent-filter> 11 <intent-filter> 12 <action android:name="android.intent.action.PACKAGE_REMOVED" /> 13 14 <data android:scheme="package" /> 15 </intent-filter> 16 </receiver> 17 <receiver 18 android:name="com.umeng.message.UmengBroadcastReceiver" > 19 <intent-filter> 20 <action android:name="org.agoo.android.intent.action.RECEIVE" /> 21 </intent-filter> 22 <intent-filter> 23 <action android:name="[包名].intent.action.COMMAND" /> 24 </intent-filter> 25 <intent-filter> 26 <action android:name="org.agoo.android.intent.action.RE_ELECTION_V2" /> 27 </intent-filter> 28 </receiver>
1 <service 2 android:name="com.umeng.message.UmengService" 3 android:exported="true" 4 android:process=":push" > 5 <intent-filter> 6 <action android:name="[包名].intent.action.START" /> 7 </intent-filter> 8 <intent-filter> 9 <action android:name="[包名].intent.action.COCKROACH" /> 10 </intent-filter> 11 <intent-filter> 12 <action android:name="org.agoo.android.intent.action.PING" /> 13 </intent-filter> 14 </service> 15 <service 16 android:name="org.android.agoo.service.ElectionService" 17 android:exported="true" 18 android:process=":push" > 19 <intent-filter> 20 <action android:name="org.agoo.android.intent.action.ELECTION_V2" /> 21 </intent-filter> 22 </service> 23 <service android:name="com.umeng.message.UmengIntentService" />
<meta-data android:name="UMENG_APPKEY" android:value="5562c52c67e58ec940003892" > </meta-data> <meta-data android:name="UMENG_CHANNEL" android:value="QD_umeng" /> <meta-data android:name="UMENG_MESSAGE_SECRET" android:value="7bf9b88d2ba77363b61ba08288d66af0" />
更新
<!-- umeng update --> <service android:name="com.umeng.update.net.DownloadingService" android:process=":DownloadingService" > </service> <activity android:name="com.umeng.update.UpdateDialogActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" > </activity>
权限:
<!-- 必选 --> <uses-permission android:name="android.permission.SEND_SMS" /> <uses-permission android:name="android.permission.RECEIVE_SMS" /> <uses-permission android:name="android.permission.READ_SMS" /> <uses-permission android:name="android.permission.WRITE_SETTINGS" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <uses-permission android:name="android.permission.GET_TASKS" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
执行:
case R.id.settings_push_switch: if (isChecked) { // 接受推送,储存值 sputil.setValue("isPushOn", true); PushAgent mPushAgent = PushAgent.getInstance(mContext); mPushAgent.enable(); } else { // 关闭推送,储存值 sputil.setValue("isPushOn", false); PushAgent mPushAgent = PushAgent.getInstance(mContext); mPushAgent.disable(); } break;