0

我使用火力地堡雲端通訊並希望顯示的電話。成功接收的火力消息和通知部分工作,但我無法從我的FirebaseMessagingService內啓動ShowCallActivity當應用程序被關閉,是DEAD當應用程序死亡時從FCM啓動活動?

@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()); 
     } 
    } 

} 
// 

該通知顯示,但它不會打開死去的應用程序。

回答

0
Intent resultIntent = new Intent(this, MainActivity.class); 
     resultIntent.putExtra("msg", name); 
     PendingIntent resultPendingIntent = PendingIntent.getActivity(this, 0, 
       resultIntent, PendingIntent.FLAG_ONE_SHOT); 

使用此您發送通知內,用您想打開

+0

這已經工作類在MainActivity。我想要的是打電話。在通話期間,不需要點擊通知。 –

+1

http://stackoverflow.com/questions/37554274/open-app-on-firebase-notification-received-fcm –

相關問題