一、【极光推送】

149 阅读1分钟

手动集成(相比之下使用jcenter集成更加方便): 1.主要是按照极光文档完成配置 主要参考网址: https://docs.jiguang.cn/jpush/client/Android/android_guide/ 2.进阶教程(主要是是Receiver):https://docs.jiguang.cn/jpush/client/Android/android_senior/ 3.具体的消息内容字段:https://docs.jiguang.cn/jpush/client/Android/android_api/

附:Receiver 消息接收类

public class MyJpushReceiver extends BroadcastReceiver {

    private static final String TAG = "MyJpushReceiver";

    private NotificationManager nm;

    @Override
    public void onReceive(Context context, Intent intent) {

        if (null == nm) {
            nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
        }

        Bundle bundle = intent.getExtras();

        if (JPushInterface.ACTION_REGISTRATION_ID.equals(intent.getAction())) {
            Log.d(TAG, "JPush用户注册成功");

        } else if (JPushInterface.ACTION_MESSAGE_RECEIVED.equals(intent.getAction())) {
            Log.d(TAG, "接受到推送下来的自定义消息");

        } else if (JPushInterface.ACTION_NOTIFICATION_RECEIVED.equals(intent.getAction())) {
            Log.d(TAG, "接受到推送下来的通知");

        } else if (JPushInterface.ACTION_NOTIFICATION_OPENED.equals(intent.getAction())) {
            Log.d(TAG, "用户点击打开了通知");

        } else {
            Log.d(TAG, "Unhandled intent - " + intent.getAction());
        }

    }
}