权限: <!-- 个推SDK权限配置开始 -->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_TASKS" />
<!-- ibeancon 需要蓝牙权限 -->
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<!-- 支持个推3.0 电子围栏功能 -->
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<!-- 浮动通知权限 -->
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
<!-- 自定义权限 -->
<uses-permission android:name="getui.permission.GetuiService.
com.example.youzhen" />
<permission
android:name="getui.permission.GetuiService.
com.example.youzhen"
android:protectionLevel="normal" >
</permission>
<!-- 个推SDK权限配置结束 -->
其他的一些:
<!--个推SDK配置开始-->
<!--个推SDK配置开始 -->
<!--个推SDK配置开始 -->
<!-- 配置的第三方参数属性 -->
<meta-data
android:name="PUSH_APPID"
android:value="
5e3lxxXV1n7PTbhIWu8ur8" /><!--替换为应用的APPID-->
<meta-data
android:name="PUSH_APPKEY"
android:value="
8VeNiV0zeA7i4Ghso9HkY3" /><!--替换为应用的APPKEY-->
<meta-data
android:name="PUSH_APPSECRET"
android:value="
Arsg5Cerei6nIpHNKjQQl7" /><!--替换为应用的APPSECRET-->
<!-- 配置第三方Receiver 用来接收ClientId和透传消息 -->
<!-- 配置第三方Receiver 用来接收ClientId和透传消息5e3lxxXV1n7PTbhIWu8ur8换成 个推的APPID -->
<receiver
android:name="
com.getui.tools.PushDemoReceiver"
android:exported="false" >
<intent-filter>
<action android:name="com.igexin.sdk.action.
5e3lxxXV1n7PTbhIWu8ur8" />
</intent-filter>
</receiver>
<!-- 配置SDK核心服务 -->
<service
android:name="com.igexin.sdk.PushService"
android:exported="true"
android:label="NotificationCenter"
android:process=":pushservice" >
</service>
<!-- SDK 2.6.1.0版本新增配置项 -->
<service
android:name="com.igexin.sdk.PushServiceUser"
android:exported="true"
android:label="NotificationCenterUser" >
</service>
<receiver android:name="com.igexin.sdk.PushReceiver" >
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
<action android:name="android.intent.action.USER_PRESENT" />
<action android:name="com.igexin.sdk.action.refreshls" />
<!-- 以下三项为可选的action声明,可大大提高service存活率和消息到达速度 -->
<action android:name="android.intent.action.MEDIA_MOUNTED" />
<action android:name="android.intent.action.ACTION_POWER_CONNECTED" />
<action android:name="android.intent.action.ACTION_POWER_DISCONNECTED" />
</intent-filter>
</receiver>
<receiver
android:name="com.igexin.sdk.PushManagerReceiver"
android:exported="false" >
<intent-filter>
<action android:name="com.igexin.sdk.action.pushmanager" />
</intent-filter>
</receiver>
<activity
android:name="com.igexin.sdk.PushActivity"
android:excludeFromRecents="true"
android:exported="false"
android:process=":pushservice"
android:taskAffinity="com.igexin.sdk.PushActivityTask"
android:theme="@android:style/Theme.Translucent.NoTitleBar" >
</activity>
<service
android:name="com.igexin.download.DownloadService"
android:process=":pushservice" />
<receiver android:name="com.igexin.download.DownloadReceiver" >
<intent-filter>
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
</intent-filter>
</receiver>
<!-- 自己的包名 -->
<provider
android:name="com.igexin.download.DownloadProvider"
android:exported="true"
android:authorities="downloads.
com.example.youzhen"
android:process=":pushservice" />
<activity
android:name="com.igexin.getuiext.activity.GetuiExtActivity"
android:configChanges="orientation|keyboard|keyboardHidden"
android:excludeFromRecents="true"
android:exported="false"
android:process=":pushservice"
android:taskAffinity="android.task.myServicetask"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<receiver
android:name="com.igexin.getuiext.service.PayloadReceiver"
android:exported="false" >
<intent-filter>
<action android:name="com.igexin.sdk.action.7fjUl2Z3LH6xYy7NQK4ni4" />
<action android:name="com.igexin.sdk.action.u1bvYz0P1l5TcWgd8hMxY8" />
</intent-filter>
</receiver>
<service
android:name="com.igexin.getuiext.service.GetuiExtService"
android:process=":pushservice" />
<!-- 个推SDK配置结束 -->
<!-- 个推SDK配置结束 -->
<!-- 个推SDK配置结束 -->
二: 首个启动的activity中初始化
//在应用程序初始化阶段,初始化SDK
PushManager.getInstance().initialize(this);
三: PushDemoReceiver文件添加到工程中
其实很简单在AndroidManifest.xml中将MainActivity定义为:
android:launchMode="singleTask" 即可:
android:launchMode="singleTask" 即可:
<activity android:name="com.withiter.quhao.activity.MainTabActivity" android:launchMode="singleTask" android:label="@string/app_name" android:screenOrientation="portrait">
这样每次打开推送,就不会出现2个activity的情况了(http://www.tuicool.com/articles/zuaY7n)