huawei push notifications integrated.
parent
94b591b23d
commit
c00e09fddd
@ -0,0 +1,25 @@
|
||||
package com.example.test_sa;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.huawei.hms.push.HmsMessageService;
|
||||
import com.huawei.hms.push.RemoteMessage;
|
||||
|
||||
public class HService extends HmsMessageService {
|
||||
|
||||
@Override
|
||||
public void onMessageReceived(RemoteMessage remoteMessage) {
|
||||
super.onMessageReceived(remoteMessage);
|
||||
|
||||
if (remoteMessage != null) {
|
||||
System.out.println("remote:"+remoteMessage.getData());
|
||||
if (!remoteMessage.getData().isEmpty()) {
|
||||
Log.d("HMS", "Payload" + remoteMessage.getData());
|
||||
}
|
||||
|
||||
if (remoteMessage.getNotification() != null) {
|
||||
Log.d("HMS", "Message Notification Body: " + remoteMessage.getNotification().getBody());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue