NIMSDK-AOS  10.5.0
HonorPushMessageService.java
浏览该文件的文档.
1 package com.netease.nimlib.sdk.mixpush;
2 
3 import android.app.Service;
4 import android.content.Context;
5 import android.content.Intent;
6 import android.os.IBinder;
7 import androidx.annotation.Nullable;
8 import com.hihonor.push.sdk.HonorPushDataMsg;
9 import com.netease.nimlib.log.NimLog;
10 import com.netease.nimlib.mixpush.model.PushType;
11 import com.netease.nimlib.mixpush.platforms.MixPushPlatforms;
12 
17 public 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 
42  public void onMessageReceived(HonorPushDataMsg msg) {
43  NimLog.mixPush(TAG + " onMessageReceived");
44  }
45 
46 }
以下这些方法运行在非 UI 线程中, 与荣耀的HonorMessageService 方法一一对应。 当开发者自身也接入荣耀推送...
void onMessageReceived(HonorPushDataMsg msg)
透传消息, 需要用户自己弹出通知