极光推送使用
来源:互联网 发布:观察者手机控制软件 编辑:程序博客网 时间:2024/05/17 04:55
1,极光推送SDK下载:http://docs.jiguang.cn/resources/
2,加压下载的压缩包,将libs中的文件夹或文件放入项目中libs,把res下对应资源一一放入项目中对应名称文件夹。
3,根据你使用的开发工具的不同,打开对应的manifest文件进行对照更改。
4,注意在manifest中的application标签中添加属性name并赋值下面class的名称:
import cn.jpush.android.api.JPushInterface;
import android.app.Application;
public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
//设置极光推送的debug
JPushInterface.setDebugMode(true);
//初始化极光推送
JPushInterface.init(this);
}
}
5,在MainActivity中添加统计代码:
@Override
protected void onResume() {
super.onResume();
JPushInterface.onResume(this);
}
@Override
protected void onPause() {
super.onPause();
JPushInterface.onPause(this);
}
*6,如果使用的是AndroidStudio:
请在src---build.gradle下添加以下代码帮助加载so文件:
sourceSets.main{
jniLibs.srcDirs=['libs']
}
7,建立个人MyReceiver用于接收处理msg或notification:
public class MyReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if(intent.getAction().equals(JPushInterface.ACTION_MESSAGE_RECEIVED)){
Bundle b= intent.getExtras();
String title = b.getString(JPushInterface.EXTRA_TITLE);
String content = b.getString(JPushInterface.EXTRA_MESSAGE);
Toast.makeText(context, "title========="+title+"............msg======="+content, 1).show();
}
}
}
2,加压下载的压缩包,将libs中的文件夹或文件放入项目中libs,把res下对应资源一一放入项目中对应名称文件夹。
3,根据你使用的开发工具的不同,打开对应的manifest文件进行对照更改。
4,注意在manifest中的application标签中添加属性name并赋值下面class的名称:
import cn.jpush.android.api.JPushInterface;
import android.app.Application;
public class App extends Application {
@Override
public void onCreate() {
super.onCreate();
//设置极光推送的debug
JPushInterface.setDebugMode(true);
//初始化极光推送
JPushInterface.init(this);
}
}
5,在MainActivity中添加统计代码:
@Override
protected void onResume() {
super.onResume();
JPushInterface.onResume(this);
}
@Override
protected void onPause() {
super.onPause();
JPushInterface.onPause(this);
}
*6,如果使用的是AndroidStudio:
请在src---build.gradle下添加以下代码帮助加载so文件:
sourceSets.main{
jniLibs.srcDirs=['libs']
}
7,建立个人MyReceiver用于接收处理msg或notification:
public class MyReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if(intent.getAction().equals(JPushInterface.ACTION_MESSAGE_RECEIVED)){
Bundle b= intent.getExtras();
String title = b.getString(JPushInterface.EXTRA_TITLE);
String content = b.getString(JPushInterface.EXTRA_MESSAGE);
Toast.makeText(context, "title========="+title+"............msg======="+content, 1).show();
}
}
}
0 0
- 极光推送使用
- 极光推送的使用
- 极光推送的使用
- 极光推送的使用
- 极光推送的使用
- 极光推送使用
- Android 极光推送使用
- 极光推送的使用
- PHP使用极光推送
- 极光推送使用教程
- 极光推送使用 IOS端
- ios极光推送使用总结
- 极光推送的使用介绍
- 极光推送的使用介绍
- 极光推送的使用步骤
- PhoneGap极光推送插件使用
- 极光推送的使用过程
- 使用极光推送的方法
- 随笔-_SCNetworkReachabilityGetFlags报错原因
- [JavaWeb]JavaSocket获取网页源代码遇见的问题。
- Java之用继承进行设计详解(附源码)
- 求1~100的和
- Remove Duplicates from Sorted List
- 极光推送使用
- JS之常用互动方法
- 最后的打板计划
- Android学习笔记(SharedPreferences的使用)
- 华为机试题--高铁换乘(Floyed算法)
- 234. Palindrome Linked List
- HDU 4807 Lunch Time(费用流)
- 修改jquery.validate.js计算中文字符长度的规则。
- FastClick使用之trigger触发click失效