【发布时间】:2016-08-30 12:24:28
【问题描述】:
我正在使用 Firebase 云消息传递,并希望显示通话。 Firebase 消息已成功接收并且通知部分有效,但当应用程序已关闭且 DEAD
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
if(remoteMessage.getNotification().getBody().equals("showcall")) {
Log.e(TAG,"Want to start activity");
Intent intent = new Intent(this,ShowCallActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
sendNotification(remoteMessage.getNotification().getTitle(),remoteMessage.getNotification().getBody());
}
}
}
//
显示通知,但不会打开死应用。
【问题讨论】:
-
这个问题你解决了吗?
-
stackoverflow.com/a/51860819/5841416可以从服务器端解决。
-
这将触发 onMessageReceived 回调。
标签: android android-intent firebase firebase-cloud-messaging