Android Studio 集成极光推送
来源:互联网 发布:json是转换是什么 编辑:程序博客网 时间:2024/05/29 13:23
今天研究了一下极光推送,有的文档写的不是很全面,自己补充了一下,非常适合新手上路
*把下载好的SDK jar包直接放到libs目录下,创建jniLibs文件夹,把SDK所有的文件夹都拷贝到这个目录下
然后开始在清单文件中配置
*注意了
<?xml version="1.0" encoding="utf-8"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" package="你的包名"> <!-- Required --> <permission android:name="你的包名.permission.JPUSH_MESSAGE" android:protectionLevel="signature" /> <!-- Required --> <!-- 各种麻烦的权限--> <uses-permission android:name="你的包名.permission.JPUSH_MESSAGE" /> <uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.WRITE_SETTINGS" /> <!-- Optional. Required for location feature --> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" /> <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" /> <application <!-- Required SDK 核心功能--> <!-- option since 2.0.5 可配置PushService,DaemonService,PushReceiver,AlarmReceiver的android:process参数将JPush相关组件设置为一个独立进程 --> <!-- 如:android:process=":remote" --> <service android:name="cn.jpush.android.service.PushService" android:enabled="true" android:exported="false" > <intent-filter> <action android:name="cn.jpush.android.intent.REGISTER" /> <action android:name="cn.jpush.android.intent.REPORT" /> <action android:name="cn.jpush.android.intent.PushService" /> <action android:name="cn.jpush.android.intent.PUSH_TIME" /> </intent-filter> </service> <!-- since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 --> <!-- 若不启用该功能可删除该组件,将不拉起其他应用也不能被其他应用拉起 --> <service android:name="cn.jpush.android.service.DaemonService" android:enabled="true" android:exported="true"> <intent-filter > <action android:name="cn.jpush.android.intent.DaemonService" /> <category android:name="你的包名"/> </intent-filter> </service> <!-- Required --> <receiver android:name="cn.jpush.android.service.PushReceiver" android:enabled="true" > <intent-filter android:priority="1000"> <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" /> <category android:name="你的包名"/> </intent-filter> <intent-filter> <action android:name="android.intent.action.USER_PRESENT" /> <action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> </intent-filter> <!-- Optional --> <intent-filter> <action android:name="android.intent.action.PACKAGE_ADDED" /> <action android:name="android.intent.action.PACKAGE_REMOVED" /> <data android:scheme="package" /> </intent-filter> </receiver> <!-- Required SDK核心功能--> <activity android:name="cn.jpush.android.ui.PushActivity" android:configChanges="orientation|keyboardHidden" android:exported="false" > <intent-filter> <action android:name="cn.jpush.android.ui.PushActivity" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="你的包名" /> </intent-filter> </activity> <!-- Required SDK核心功能--> <service android:name="cn.jpush.android.service.DownloadService" android:enabled="true" android:exported="false" > </service> <!-- Required SDK核心功能--> <receiver android:name="cn.jpush.android.service.AlarmReceiver" /> <!-- User defined. 用户自定义的广播接收器--> <receiver android:name=".MyReceiver" android:enabled="true"> <intent-filter> <!--Required 用户注册SDK的intent--> <action android:name="cn.jpush.android.intent.REGISTRATION" /> <!--Required 用户接收SDK消息的intent--> <action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" /> <!--Required 用户接收SDK通知栏信息的intent--> <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" /> <!--Required 用户打开自定义通知栏的intent--> <action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" /> <!--Optional 用户接受Rich Push Javascript 回调函数的intent--> <action android:name="cn.jpush.android.intent.ACTION_RICHPUSH_CALLBACK" /> <!-- 接收网络变化 连接/断开 since 1.6.3 --> <action android:name="cn.jpush.android.intent.CONNECTION" /> <category android:name="com.example.macaopark.myapplicationx" /> </intent-filter> </receiver> <!-- Required. For publish channel feature --> <!-- JPUSH_CHANNEL 是为了方便开发者统计APK分发渠道。--> <!-- 例如: --> <!-- 发到 Google Play 的APK可以设置为 google-play; --> <!-- 发到其他市场的 APK 可以设置为 xxx-market。 --> <!-- 目前这个渠道统计功能的报表还未开放。--> <meta-data android:name="JPUSH_CHANNEL" android:value="developer-default"/> <!-- Required. AppKey copied from Portal --> <meta-data android:name="JPUSH_APPKEY" android:value="你的KEY就是极光推送那个!"/> </application></manifest>
**在MainActivity中配置
public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); /**很重要**/ JPushInterface.setDebugMode(true); JPushInterface.init(this); setContentView(R.layout.activity_main); }}
结果图
1 0
- android studio集成极光推送
- Android Studio 集成极光推送
- Android Studio集成极光推送
- Android Studio集成极光推送
- android studio集成极光推送
- Android 集成极光推送(Android studio)
- android studio极光推送的集成
- android studio 集成极光推送(1)
- 使用android studio集成极光推送
- Android Studio jcenter 自动集成极光推送
- Android 极光推送集成
- android极光推送集成
- Android集成极光推送
- android集成极光推送
- Android集成极光推送
- android 集成极光推送
- Java.lang.UnsatisfiedLinkError android studio集成Jpush极光推送
- 怎样使用Android studio将极光推送集成
- 【封装】Java方法大集合
- Qt对话框显示opencv读取的图像
- 分区存储管理
- 第十二天学习笔记
- DEFERRABLE约束切换实验
- Android Studio 集成极光推送
- javascript+css 实现滚动效果
- windows下GDAL环境搭建
- 多线程
- 【学习笔记】第十章 内部类
- android如何设置全屏显示
- 2016 杭州云栖大会随笔
- Jsp之9种常用内置对象浅析(二)
- 暴力