ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

极光推送jpush(简单易懂,分分钟教你搞定)

2020-10-09 11:34:24  阅读:306  来源: 互联网

标签:sgy jpush EXTRA bundle JPushInterface 易懂 android 推送


先注册账户:

然后点击开发者服务:点击打开链接

创建应用:

随便起个名字,但是最好和你的应用名字一样

然后点击下一步推送设置

把你的工程应用名字输入:

应用包名就是build.gradle文件里的applicationId 名字

完成之后点击下载Demo

Demo下载完成之后解压 ,压缩包
将libs文件夹里的工具jar包全部复制到你的项目中,记得编译

 

 

 

将文件中的jar包导入工程中的libs文件夹 并引用, 
在将res文件夹直接复制到项目中的src文件夹下的main文件夹里, 
它会直接补齐你工程中缺少的部分,所以不用害怕它会替换掉你的原文件

 

 

 

使用 android studio 的开发者,如果使用 jniLibs 文件夹导入 so 文件,则仅需将所有 cpu 类型的文件夹拷进去;如果将 so 文件添加在 module的libs 文件夹下,注意在 module 的 gradle 配置中添加一下配置:

  1. sourceSets {
  2. main {
  3. jniLibs.srcDirs = ['libs']
  4. }
  5. }

注意点,还有 jniLibs 空文件夹不要忘

 

 

 

 

MyApp  类(记得在清单文件中添加name)

  1. public class MyApp extends Application {
  2. public static String registrationId ;//获取 极光推送的设备唯一性标识 RegistrationID
  3.  
  4. @Override
  5. public void onCreate() {
  6. super.onCreate();
  7.  
  8.  
  9. //极光推送
  10. JPushInterface.setDebugMode(true); // 设置开启日志,发布时请关闭日志
  11. JPushInterface.init(this); // 初始化 JPush
  12.  
  13. registrationId = JPushInterface.getRegistrationID(this);//获取 极光推送的设备唯一性标识 RegistrationID
  14. Log.e("111111registrationId", "run:--------->:" + registrationId );
  15. }
  16. }

 

MyReceiver

TestActivity

Logger 

MyReceiver
  1. package com.sgy.sgy_jpush;
  2.  
  3. import android.content.BroadcastReceiver;
  4. import android.content.Context;
  5. import android.content.Intent;
  6. import android.os.Bundle;
  7. import android.text.TextUtils;
  8. import org.json.JSONException;
  9. import org.json.JSONObject;
  10. import java.util.Iterator;
  11. import cn.jpush.android.api.JPushInterface;
  12.  
  13. /**
  14. * 自定义接收器
  15. *
  16. * 如果不定义这个 Receiver,则:
  17. * 1) 默认用户会打开主界面
  18. * 2) 接收不到自定义消息
  19. */
  20. public class MyReceiver extends BroadcastReceiver {
  21. private static final String TAG = "JIGUANG-Example";
  22.  
  23. @Override
  24. public void onReceive(Context context, Intent intent) {
  25. try {
  26. Bundle bundle = intent.getExtras();
  27. Logger.d(TAG, "[MyReceiver] onReceive - " + intent.getAction() + ", extras: " + printBundle(bundle));
  28.  
  29. if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) {
  30. String regId = bundle.getString(JPushInterface.EXTRA_REGISTRATION_ID);
  31. Logger.d(TAG, "[MyReceiver] 接收Registration Id : " + regId);
  32. //send the Registration Id to your server...
  33.  
  34. } else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) {
  35. Logger.d(TAG, "[MyReceiver] 接收到推送下来的自定义消息: " + bundle.getString(JPushInterface.EXTRA_MESSAGE));
  36. // processCustomMessage(context, bundle);
  37.  
  38. } else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) {
  39. Logger.d(TAG, "[MyReceiver] 接收到推送下来的通知");
  40. int notifactionId = bundle.getInt(JPushInterface.EXTRA_NOTIFICATION_ID);
  41. Logger.d(TAG, "[MyReceiver] 接收到推送下来的通知的ID: " + notifactionId);
  42.  
  43. } else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) {
  44. Logger.d(TAG, "[MyReceiver] 用户点击打开了通知");
  45.  
  46. //打开自定义的Activity
  47. Intent i = new Intent(context, TestActivity.class);
  48. i.putExtras(bundle);
  49. //i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  50. i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP );
  51. context.startActivity(i);
  52.  
  53. } else if (JPushInterface.ACTION_RICHPUSH_CALLBACK.equals(intent.getAction())) {
  54. Logger.d(TAG, "[MyReceiver] 用户收到到RICH PUSH CALLBACK: " + bundle.getString(JPushInterface.EXTRA_EXTRA));
  55. //在这里根据 JPushInterface.EXTRA_EXTRA 的内容处理代码,比如打开新的Activity, 打开一个网页等..
  56.  
  57. } else if(JPushInterface.ACTION_CONNECTION_CHANGE.equals(intent.getAction())) {
  58. boolean connected = intent.getBooleanExtra(JPushInterface.EXTRA_CONNECTION_CHANGE, false);
  59. Logger.w(TAG, "[MyReceiver]" + intent.getAction() +" connected state change to "+connected);
  60. } else {
  61. Logger.d(TAG, "[MyReceiver] Unhandled intent - " + intent.getAction());
  62. }
  63. } catch (Exception e){
  64.  
  65. }
  66.  
  67. }
  68.  
  69. // 打印所有的 intent extra 数据
  70. private static String printBundle(Bundle bundle) {
  71. StringBuilder sb = new StringBuilder();
  72. for (String key : bundle.keySet()) {
  73. if (key.equals(JPushInterface.EXTRA_NOTIFICATION_ID)) {
  74. sb.append("\nkey:" + key + ", value:" + bundle.getInt(key));
  75. }else if(key.equals(JPushInterface.EXTRA_CONNECTION_CHANGE)){
  76. sb.append("\nkey:" + key + ", value:" + bundle.getBoolean(key));
  77. } else if (key.equals(JPushInterface.EXTRA_EXTRA)) {
  78. if (TextUtils.isEmpty(bundle.getString(JPushInterface.EXTRA_EXTRA))) {
  79. Logger.i(TAG, "This message has no Extra data");
  80. continue;
  81. }
  82.  
  83. try {
  84. JSONObject json = new JSONObject(bundle.getString(JPushInterface.EXTRA_EXTRA));
  85. Iterator<String> it = json.keys();
  86.  
  87. while (it.hasNext()) {
  88. String myKey = it.next();
  89. sb.append("\nkey:" + key + ", value: [" +
  90. myKey + " - " +json.optString(myKey) + "]");
  91. }
  92. } catch (JSONException e) {
  93. Logger.e(TAG, "Get message extra JSON error!");
  94. }
  95.  
  96. } else {
  97. sb.append("\nkey:" + key + ", value:" + bundle.get(key));
  98. }
  99. }
  100. return sb.toString();
  101. }
  102.  
  103. //send msg to MainActivity
  104. // private void processCustomMessage(Context context, Bundle bundle) {
  105. // if (MainActivity.isForeground) {
  106. // String message = bundle.getString(JPushInterface.EXTRA_MESSAGE);
  107. // String extras = bundle.getString(JPushInterface.EXTRA_EXTRA);
  108. // Intent msgIntent = new Intent(MainActivity.MESSAGE_RECEIVED_ACTION);
  109. // msgIntent.putExtra(MainActivity.KEY_MESSAGE, message);
  110. // if (!ExampleUtil.isEmpty(extras)) {
  111. // try {
  112. // JSONObject extraJson = new JSONObject(extras);
  113. // if (extraJson.length() > 0) {
  114. // msgIntent.putExtra(MainActivity.KEY_EXTRAS, extras);
  115. // }
  116. // } catch (JSONException e) {
  117. //
  118. // }
  119. //
  120. // }
  121. // LocalBroadcastManager.getInstance(context).sendBroadcast(msgIntent);
  122. // }
  123. // }
  124. }
TestActivity
  1. package com.sgy.sgy_jpush;
  2.  
  3. import android.app.Activity;
  4. import android.content.Intent;
  5. import android.os.Bundle;
  6. import android.view.ViewGroup.LayoutParams;
  7. import android.widget.TextView;
  8. import cn.jpush.android.api.JPushInterface;
  9.  
  10. public class TestActivity extends Activity {
  11.  
  12. @Override
  13. protected void onCreate(Bundle savedInstanceState) {
  14. super.onCreate(savedInstanceState);
  15. TextView tv = new TextView(this);
  16. tv.setText("用户自定义打开的Activity");
  17. Intent intent = getIntent();
  18. if (null != intent) {
  19. Bundle bundle = getIntent().getExtras();
  20. String title = null;
  21. String content = null;
  22. if(bundle!=null){
  23. title = bundle.getString(JPushInterface.EXTRA_NOTIFICATION_TITLE);
  24. content = bundle.getString(JPushInterface.EXTRA_ALERT);
  25. }
  26. tv.setText("Title : " + title + " " + "Content : " + content);
  27. }
  28. addContentView(tv, new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
  29. }
  30.  
  31. }
Logger 
  1. package com.sgy.sgy_jpush;
  2.  
  3. import android.util.Log;
  4.  
  5. /**
  6. * Created by efan on 2017/4/13.
  7. */
  8.  
  9. public class Logger {
  10.  
  11. //设为false关闭日志
  12. private static final boolean LOG_ENABLE = true;
  13.  
  14. public static void i(String tag, String msg){
  15. if (LOG_ENABLE){
  16. Log.i(tag, msg);
  17. }
  18. }
  19. public static void v(String tag, String msg){
  20. if (LOG_ENABLE){
  21. Log.v(tag, msg);
  22. }
  23. }
  24. public static void d(String tag, String msg){
  25. if (LOG_ENABLE){
  26. Log.d(tag, msg);
  27. }
  28. }
  29. public static void w(String tag, String msg){
  30. if (LOG_ENABLE){
  31. Log.w(tag, msg);
  32. }
  33. }
  34. public static void e(String tag, String msg){
  35. if (LOG_ENABLE){
  36. Log.e(tag, msg);
  37. }
  38. }
  39. }

 

 

清单文件:加权限:

  1. <!-- Required -->
  2. <permission
  3. android:name="com.sgy.sgy_jpush.permission.JPUSH_MESSAGE"
  4. android:protectionLevel="signature" />
  5.  
  6. <!-- Required 一些系统要求的权限,如访问网络等-->
  7. <uses-permission android:name="com.sgy.sgy_jpush.permission.JPUSH_MESSAGE" />
  8. <uses-permission android:name="android.permission.RECEIVE_USER_PRESENT" />
  9. <uses-permission android:name="android.permission.INTERNET" />
  10. <uses-permission android:name="android.permission.READ_PHONE_STATE" />
  11. <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  12. <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
  13. <uses-permission android:name="android.permission.WRITE_SETTINGS" />
  14. <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
  15. <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
  16. <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
  17.  
  18. <!-- Optional for location -->
  19. <uses-permission android:name="android.permission.VIBRATE" />
  20. <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!-- 用于开启 debug 版本的应用在6.0 系统上 层叠窗口权限 -->
  21. <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
  22. <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
  23. <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
  24. <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS" />
  25. <uses-permission android:name="android.permission.CHANGE_NETWORK_STATE" />
  26. <uses-permission android:name="android.permission.GET_TASKS" />

 

  1. <!-- For test only 测试状态通知栏,需要打开的Activity -->
  2. <activity android:name="com.sgy.sgy_jpush.TestActivity" android:exported="false">
  3. <intent-filter>
  4. <action android:name="jpush.testAction" />
  5. <category android:name="jpush.testCategory" />
  6. </intent-filter>
  7. </activity>
  8.  
  9. <!-- Rich push 核心功能 since 2.0.6-->
  10. <activity
  11. android:name="cn.jpush.android.ui.PopWinActivity"
  12. android:theme="@style/MyDialogStyle"
  13. android:exported="false">
  14. </activity>
  15.  
  16. <!-- Required SDK核心功能-->
  17. <activity
  18. android:name="cn.jpush.android.ui.PushActivity"
  19. android:configChanges="orientation|keyboardHidden"
  20. android:theme="@android:style/Theme.NoTitleBar"
  21. android:exported="false">
  22. <intent-filter>
  23. <action android:name="cn.jpush.android.ui.PushActivity" />
  24. <category android:name="android.intent.category.DEFAULT" />
  25. <category android:name="com.sgy.sgy_jpush" />
  26. </intent-filter>
  27. </activity>
  28.  
  29. <!-- Required SDK 核心功能-->
  30. <!-- 可配置android:process参数将PushService放在其他进程中 -->
  31. <service
  32. android:name="cn.jpush.android.service.PushService"
  33. android:process=":pushcore"
  34. android:exported="false">
  35. <intent-filter>
  36. <action android:name="cn.jpush.android.intent.REGISTER" />
  37. <action android:name="cn.jpush.android.intent.REPORT" />
  38. <action android:name="cn.jpush.android.intent.PushService" />
  39. <action android:name="cn.jpush.android.intent.PUSH_TIME" />
  40. </intent-filter>
  41. </service>
  42. <!-- since 3.0.9 Required SDK 核心功能-->
  43. <provider
  44. android:authorities="com.sgy.sgy_jpush.DataProvider"
  45. android:name="cn.jpush.android.service.DataProvider"
  46. android:process=":pushcore"
  47. android:exported="false"
  48. />
  49.  
  50. <!-- since 1.8.0 option 可选项。用于同一设备中不同应用的JPush服务相互拉起的功能。 -->
  51. <!-- 若不启用该功能可删除该组件,将不拉起其他应用也不能被其他应用拉起 -->
  52. <service
  53. android:name="cn.jpush.android.service.DaemonService"
  54. android:enabled="true"
  55. android:exported="true">
  56. <intent-filter>
  57. <action android:name="cn.jpush.android.intent.DaemonService" />
  58. <category android:name="com.sgy.sgy_jpush" />
  59. </intent-filter>
  60.  
  61. </service>
  62. <!-- since 3.1.0 Required SDK 核心功能-->
  63. <provider
  64. android:authorities="com.sgy.sgy_jpush.DownloadProvider"
  65. android:name="cn.jpush.android.service.DownloadProvider"
  66. android:exported="true"
  67. />
  68. <!-- Required SDK核心功能-->
  69. <receiver
  70. android:name="cn.jpush.android.service.PushReceiver"
  71. android:enabled="true"
  72. android:exported="false">
  73. <intent-filter android:priority="1000">
  74. <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" /> <!--Required 显示通知栏 -->
  75. <category android:name="com.sgy.sgy_jpush" />
  76. </intent-filter>
  77. <intent-filter>
  78. <action android:name="android.intent.action.USER_PRESENT" />
  79. <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
  80. </intent-filter>
  81. <!-- Optional -->
  82. <intent-filter>
  83. <action android:name="android.intent.action.PACKAGE_ADDED" />
  84. <action android:name="android.intent.action.PACKAGE_REMOVED" />
  85.  
  86. <data android:scheme="package" />
  87. </intent-filter>
  88. </receiver>
  89.  
  90. <!-- Required SDK核心功能-->
  91. <receiver android:name="cn.jpush.android.service.AlarmReceiver" android:exported="false"/>
  92.  
  93. <!-- User defined. For test only 用户自定义的广播接收器-->
  94. <receiver
  95. android:name="com.sgy.sgy_jpush.MyReceiver"
  96. android:exported="false"
  97. android:enabled="true">
  98. <intent-filter>
  99. <action android:name="cn.jpush.android.intent.REGISTRATION" /> <!--Required 用户注册SDK的intent-->
  100. <action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" /> <!--Required 用户接收SDK消息的intent-->
  101. <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" /> <!--Required 用户接收SDK通知栏信息的intent-->
  102. <action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" /> <!--Required 用户打开自定义通知栏的intent-->
  103. <action android:name="cn.jpush.android.intent.CONNECTION" /><!-- 接收网络变化 连接/断开 since 1.6.3 -->
  104. <category android:name="com.sgy.sgy_jpush" />
  105. </intent-filter>
  106. </receiver>
  107.  
  108. <!-- Required . Enable it you can get statistics data with channel -->
  109. <meta-data android:name="JPUSH_CHANNEL" android:value="developer-default"/>
  110. <meta-data android:name="JPUSH_APPKEY" android:value="da075747e2a374d552993f2a" /> <!-- </>值来自开发者平台取得的AppKey-->

 

 

 

然后运行一下工程:

在回到极光平台:点击打开链接

 

哈哈哈,然后你就可以收到推送的消息啦,是不是很简单呢!!!

 

 

最后在附上完整的AndroidManifest.xml清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.sgy.sgy_jpush">

    <!-- Required -->
    <permission
        android:name="com.sgy.sgy_jpush.permission.JPUSH_MESSAGE"
        android:protectionLevel="signature" />

    <!-- Required  一些系统要求的权限,如访问网络等-->
    <uses-permission android:name="com.sgy.sgy_jpush.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.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.WRITE_SETTINGS" />
    <uses-permission android:name="android.permission.MOUNT_UNMOUNT_FILESYSTEMS" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

    <!-- Optional for location -->
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" /> <!-- 用于开启 debug 版本的应用在6.0 系统上 层叠窗口权限 -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <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" />
    <uses-permission android:name="android.permission.GET_TASKS" />

    <application
        android:name=".MyApp"
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity android:name=".MainActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <!-- For test only 测试状态通知栏,需要打开的Activity -->
        <activity android:name="com.sgy.sgy_jpush.TestActivity" android:exported="false">
            <intent-filter>
                <action android:name="jpush.testAction" />
                <category android:name="jpush.testCategory" />
            </intent-filter>
        </activity>

        <!-- Rich push 核心功能 since 2.0.6-->
        <activity
            android:name="cn.jpush.android.ui.PopWinActivity"
            android:theme="@style/MyDialogStyle"
            android:exported="false">
        </activity>

        <!-- Required SDK核心功能-->
        <activity
            android:name="cn.jpush.android.ui.PushActivity"
            android:configChanges="orientation|keyboardHidden"
            android:theme="@android:style/Theme.NoTitleBar"
            android:exported="false">
            <intent-filter>
                <action android:name="cn.jpush.android.ui.PushActivity" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="com.sgy.sgy_jpush" />
            </intent-filter>
        </activity>

        <!-- Required SDK 核心功能-->
        <!-- 可配置android:process参数将PushService放在其他进程中 -->
        <service
            android:name="cn.jpush.android.service.PushService"
            android:process=":pushcore"
            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 3.0.9 Required SDK 核心功能-->
        <provider
            android:authorities="com.sgy.sgy_jpush.DataProvider"
            android:name="cn.jpush.android.service.DataProvider"
            android:process=":pushcore"
            android:exported="false"
            />

        <!-- 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="com.sgy.sgy_jpush" />
            </intent-filter>

        </service>
        <!-- since 3.1.0 Required SDK 核心功能-->
        <provider
            android:authorities="com.sgy.sgy_jpush.DownloadProvider"
            android:name="cn.jpush.android.service.DownloadProvider"
            android:exported="true"
            />
        <!-- Required SDK核心功能-->
        <receiver
            android:name="cn.jpush.android.service.PushReceiver"
            android:enabled="true"
            android:exported="false">
            <intent-filter android:priority="1000">
                <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED_PROXY" />   <!--Required  显示通知栏 -->
                <category android:name="com.sgy.sgy_jpush" />
            </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核心功能-->
        <receiver android:name="cn.jpush.android.service.AlarmReceiver" android:exported="false"/>

        <!-- User defined.  For test only  用户自定义的广播接收器-->
        <receiver
            android:name="com.sgy.sgy_jpush.MyReceiver"
            android:exported="false"
            android:enabled="true">
            <intent-filter>
                <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  用户接收SDK通知栏信息的intent-->
                <action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" /> <!--Required  用户打开自定义通知栏的intent-->
                <action android:name="cn.jpush.android.intent.CONNECTION" /><!-- 接收网络变化 连接/断开 since 1.6.3 -->
                <category android:name="com.sgy.sgy_jpush" />
            </intent-filter>
        </receiver>

        <!-- Required  . Enable it you can get statistics data with channel -->
        <meta-data android:name="JPUSH_CHANNEL" android:value="developer-default"/>
        <meta-data android:name="JPUSH_APPKEY" android:value="da075747e2a374d552993f2a" /> <!--  </>值来自开发者平台取得的AppKey-->


    </application>

</manifest>

 

标签:sgy,jpush,EXTRA,bundle,JPushInterface,易懂,android,推送
来源: https://www.cnblogs.com/bighammerdata/p/13784803.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有