极光推送(自定义消息通知)
2017-08-10 09:58
417 查看
public 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>
相关文章推荐
- 极光推送能收到通知却收不到自定义消息
- iOS集成极光推送 通知 和 自定义消息
- 极光推送能收到通知却收不到自定义消息
- Swift - JPush极光推送的使用(发送自定义消息/通知/别名/tag)
- swift3.0实现极光推送和自定义消息
- Android 使用极光推送自定义消息推送效果
- 极光后台服务器推送消息通知
- java服务器端调用JPush极光推送api推送通知消息
- 极光推送,自定义对单个安卓手机推送消息
- 极光推送企业开发系列之自定义消息
- 极光推送通知和消息
- ios 开发之 -- 极光推送,发送自定义消息,进入制定页面
- Andriod之使用极光推送自定义消息打造个性的消息推送效果
- Android之极光推送发送自定义消息
- JPush 激光推送 接收通知和自定义消息
- 最新的极光推送服务器端代码(java服务器后台向手机端自定义推送消息)
- ios极光推送的自定义消息和registerID的获取
- 极光推送自定义消息提示铃声
- iOS极光推送(接收后台消息和自定义消息)
- Android 极光推送获取自定义消息