NIMSDK-AOS  10.5.0
HWPushMessageService.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 
8 import androidx.annotation.Nullable;
9 
10 import com.huawei.hms.push.RemoteMessage;
11 import com.netease.nimlib.log.NimLog;
12 import com.netease.nimlib.mixpush.model.PushType;
13 import com.netease.nimlib.mixpush.platforms.MixPushPlatforms;
14 
20 public class HWPushMessageService extends Service {
21 
22  private static final String TAG = "HWPushMessageService";
23 
24  public void onCreate(Context context) {
25  NimLog.mixPush(TAG + " onCreate");
26  }
27 
28  @Nullable
29  @Override
30  public IBinder onBind(Intent intent) {
31  return null;
32  }
33 
34  public void onNewToken(String token) {
35  NimLog.mixPush(TAG + " onNewToken, token=" + token);
36  MixPushPlatforms.getPushPlatform(PushType.HUA_WEI).onToken(token);
37  }
38 
44  public void onMessageReceived(RemoteMessage remoteMessage) {
45  NimLog.mixPush(TAG + " onMessageReceived");
46  }
47 
48  public void onMessageSent(String s) {
49  NimLog.mixPush(TAG + " onMessageSent");
50  }
51 
52  public void onDeletedMessages() {
53  NimLog.mixPush(TAG + " onDeletedMessages");
54  }
55 
56  public void onSendError(String var1, Exception var2) {
57  NimLog.mixPush(TAG + " onSendError, " + var2);
58  }
59 }
void onMessageReceived(RemoteMessage remoteMessage)
透传消息, 需要用户自己弹出通知
以下这些方法运行在非 UI 线程中, 与HuaWei的PHmsMessageService 方法一一对应。 当开发者自身也接入HuaWei...