当您收到带有onesignal的推送通知时,将自动打开应用程序

问题描述:

我希望能够在收到推送通知而无需任何用户操作的情况下在应用程序中打开活动. 可以使用onesignal或其他方式通过推送自动打开应用程序吗?

I would like to be able to open an activity in the application when a push notification is received without any user action. Is it possible to do with onesignal or some other way to open the app automatically using a push?

您可以简单地在FirebaseMessagingService.onMessageReceived内部启动家庭活动,但是如果当前正在运行应用程序,则不必这样做.您需要一种控制器,并检查

You can simply start your home activity inside FirebaseMessagingService.onMessageReceived But if application is currently running you don't have to do that. You need kind of controller and check is application in foreground