Commit fa58e04a authored by chengkun's avatar chengkun

log.i -> timber

parent 8bb3ee7e
...@@ -8,6 +8,8 @@ import com.huawei.hms.push.RemoteMessage; ...@@ -8,6 +8,8 @@ import com.huawei.hms.push.RemoteMessage;
import java.util.Arrays; import java.util.Arrays;
import timber.log.Timber;
public class HuaweiPushGetDataService extends HmsMessageService { public class HuaweiPushGetDataService extends HmsMessageService {
private static final String TAG = "PushGetDataService"; private static final String TAG = "PushGetDataService";
...@@ -15,7 +17,7 @@ public class HuaweiPushGetDataService extends HmsMessageService { ...@@ -15,7 +17,7 @@ public class HuaweiPushGetDataService extends HmsMessageService {
// extends HmsMessageService super class // extends HmsMessageService super class
@Override @Override
public void onNewToken(String token) { public void onNewToken(String token) {
Log.i(TAG, "received refresh token:" + token); Timber.i("received refresh token:" + token);
// send the token to your app server. // send the token to your app server.
if (!TextUtils.isEmpty(token)) { if (!TextUtils.isEmpty(token)) {
refreshedTokenToServer(token); refreshedTokenToServer(token);
...@@ -24,40 +26,40 @@ public class HuaweiPushGetDataService extends HmsMessageService { ...@@ -24,40 +26,40 @@ public class HuaweiPushGetDataService extends HmsMessageService {
@Override @Override
public void onMessageReceived(RemoteMessage message) { public void onMessageReceived(RemoteMessage message) {
Log.i(TAG, "onMessageReceived is called"); Timber.i("onMessageReceived is called");
if (message == null) { if (message == null) {
Log.e(TAG, "Received message entity is null!"); Log.e(TAG, "Received message entity is null!");
return; return;
} }
Log.i(TAG, "getCollapseKey: " + message.getCollapseKey() Timber.i("getCollapseKey: " + message.getCollapseKey()
+ "\n getData: " + message.getData() + "\n getData: " + message.getData()
+ "\n getFrom: " + message.getFrom() + "\n getFrom: " + message.getFrom()
+ "\n getTo: " + message.getTo() + "\n getTo: " + message.getTo()
+ "\n getMessageId: " + message.getMessageId() + "\n getMessageId: " + message.getMessageId()
+ "\n getSendTime: " + message.getSentTime() + "\n getSendTime: " + message.getSentTime()
+ "\n getDataMap: " + message.getDataOfMap() + "\n getDataMap: " + message.getDataOfMap()
+ "\n getMessageType: " + message.getMessageType() + "\n getMessageType: " + message.getMessageType()
+ "\n getTtl: " + message.getTtl() + "\n getTtl: " + message.getTtl()
+ "\n getToken: " + message.getToken()); + "\n getToken: " + message.getToken());
RemoteMessage.Notification notification = message.getNotification(); RemoteMessage.Notification notification = message.getNotification();
if (notification != null) { if (notification != null) {
Log.i(TAG, "\n getImageUrl: " + notification.getImageUrl() Timber.i("\n getImageUrl: " + notification.getImageUrl()
+ "\n getTitle: " + notification.getTitle() + "\n getTitle: " + notification.getTitle()
+ "\n getTitleLocalizationKey: " + notification.getTitleLocalizationKey() + "\n getTitleLocalizationKey: " + notification.getTitleLocalizationKey()
+ "\n getTitleLocalizationArgs: " + Arrays.toString(notification.getTitleLocalizationArgs()) + "\n getTitleLocalizationArgs: " + Arrays.toString(notification.getTitleLocalizationArgs())
+ "\n getBody: " + notification.getBody() + "\n getBody: " + notification.getBody()
+ "\n getBodyLocalizationKey: " + notification.getBodyLocalizationKey() + "\n getBodyLocalizationKey: " + notification.getBodyLocalizationKey()
+ "\n getBodyLocalizationArgs: " + Arrays.toString(notification.getBodyLocalizationArgs()) + "\n getBodyLocalizationArgs: " + Arrays.toString(notification.getBodyLocalizationArgs())
+ "\n getIcon: " + notification.getIcon() + "\n getIcon: " + notification.getIcon()
+ "\n getSound: " + notification.getSound() + "\n getSound: " + notification.getSound()
+ "\n getTag: " + notification.getTag() + "\n getTag: " + notification.getTag()
+ "\n getColor: " + notification.getColor() + "\n getColor: " + notification.getColor()
+ "\n getClickAction: " + notification.getClickAction() + "\n getClickAction: " + notification.getClickAction()
+ "\n getChannelId: " + notification.getChannelId() + "\n getChannelId: " + notification.getChannelId()
+ "\n getLink: " + notification.getLink() + "\n getLink: " + notification.getLink()
+ "\n getNotifyId: " + notification.getNotifyId()); + "\n getNotifyId: " + notification.getNotifyId());
} }
Boolean judgeWhetherIn10s = false; Boolean judgeWhetherIn10s = false;
// If the messages are not processed in 10 seconds, the app needs to use WorkManager for processing. // If the messages are not processed in 10 seconds, the app needs to use WorkManager for processing.
...@@ -69,13 +71,13 @@ public class HuaweiPushGetDataService extends HmsMessageService { ...@@ -69,13 +71,13 @@ public class HuaweiPushGetDataService extends HmsMessageService {
} }
} }
private void startWorkManagerJob(RemoteMessage message) { private void startWorkManagerJob(RemoteMessage message) {
Log.d(TAG, "Start new job processing."); Timber.d("Start new job processing.");
} }
private void processWithin10s(RemoteMessage message) { private void processWithin10s(RemoteMessage message) {
Log.d(TAG, "Processing now."); Timber.d("Processing now.");
} }
private void refreshedTokenToServer(String token) { private void refreshedTokenToServer(String token) {
Log.i(TAG, "sending token to server. token:" + token); Timber.i("sending token to server. token:" + token);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment