NIMSDK-AOS 10.4.0-beta
载入中...
搜索中...
未找到
HonorPushMessageService.java
浏览该文件的文档.
1package com.netease.nimlib.sdk.mixpush;
2
3import android.app.Service;
4import android.content.Context;
5import android.content.Intent;
6import android.os.IBinder;
7import androidx.annotation.Nullable;
8import com.hihonor.push.sdk.HonorPushDataMsg;
9import com.netease.nimlib.log.NimLog;
10import com.netease.nimlib.mixpush.model.PushType;
11import com.netease.nimlib.mixpush.platforms.MixPushPlatforms;
12
13/**
14 * 以下这些方法运行在非 UI 线程中, 与荣耀的HonorMessageService 方法一一对应。
15 * 当开发者自身也接入荣耀推送,则应将继承 HonorMessageService 改为继承 HonorPushMessageService,其他不变
16 */
17public class HonorPushMessageService extends Service {
18
19 private static final String TAG = "HonorPushMessageService";
20 public static final String ACTION = "com.netease.nimlib.mixpush.honor.action.MESSAGING_EVENT";
21
22 public void onCreate(Context context) {
23 NimLog.mixPush(TAG + " onCreate");
24 }
25
26 @Nullable
27 @Override
28 public IBinder onBind(Intent intent) {
29 return null;
30 }
31
32 public void onNewToken(String token) {
33 NimLog.mixPush(TAG + " onNewToken, token=" + token);
34 MixPushPlatforms.getPushPlatform(PushType.HONOR).onToken(token);
35 }
36
37 /**
38 * 透传消息, 需要用户自己弹出通知
39 *
40 * @param msg
41 */
42 public void onMessageReceived(HonorPushDataMsg msg) {
43 NimLog.mixPush(TAG + " onMessageReceived");
44 }
45
46}
以下这些方法运行在非 UI 线程中, 与荣耀的HonorMessageService 方法一一对应。 当开发者自身也接入荣耀推送,则应将继承 HonorMessageService 改为继承 Honor...
void onMessageReceived(HonorPushDataMsg msg)
透传消息, 需要用户自己弹出通知