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 –

相关问题