复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); HashSet<String> set=new HashSet<>(); set.add("买衣服"); set.add("买鞋"); JPushInterface.setAliasAndTags(this, "==========", set, new TagAliasCallback() { @Override public void gotResult(int i, String s, Set<String> set) { } }); } }复制代码public class Myrecever extends BroadcastReceiver { @Override //定义广播 public void onReceive(Context context, Intent intent) { if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())){ Bundle bundle = intent.getExtras(); String message = bundle.getString(JPushInterface.EXTRA_MESSAGE); String json = bundle.getString(JPushInterface.EXTRA_EXTRA); Toast.makeText(context, "json=========="+json, Toast.LENGTH_SHORT).show(); } } }
//一定要记得注册广播 同意广播所有的接收类型的权限复制代码<receiver android:name=".Myrecever" android:enabled="true"> <intent-filter> <action android:name="cn.jpush.android.intent.REGISTRATION" /> <action android:name="cn.jpush.android.intent.MESSAGE_RECEIVED" /> <action android:name="cn.jpush.android.intent.NOTIFICATION_RECEIVED" /> <action android:name="cn.jpush.android.intent.NOTIFICATION_OPENED" /> <action android:name="cn.jpush.android.intent.NOTIFICATION_CLICK_ACTION" /> <action android:name="cn.jpush.android.intent.CONNECTION" /> <category android:name="com.bawei.wk.myapplication" /> </intent-filter> </receiver>
最后
以上就是曾经电话最近收集整理的关于极光推送(自定义消息通知)的全部内容,更多相关极光推送(自定义消息通知)内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复