【发布时间】:2020-06-02 08:16:55
【问题描述】:
我是 Android Studio 的新手,对此有疑问。
所以我有一个使用 Webview 的 android 应用程序。我还实现了 FCM 推送通知。 当我点击通知时,它直接打开主页。如果我想在点击通知时打开应用中的特定页面怎么办?
这里是主要活动
class MainActivity : Activity() {
private val URL = "https://thelink.pl"
lateinit var webView: WebView
private var notificationId: Int = 0;
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
this.requestWindowFeature(Window.FEATURE_NO_TITLE)
webView = createView()
setContentView(webView)
firebaseInstanceToken() //get token
subscibeToTopics("androidUsers")
}
这是我的 FCM 服务
// [START receive_message]
override fun onMessageReceived(remoteMessage: RemoteMessage) {
//check if message contains a data payload
remoteMessage
.data.isNotEmpty().let {
Log.d("isData", "Message data payload: " + remoteMessage.data)
theMessageBody = remoteMessage.data.get("body").toString()
theMessageTitle = remoteMessage.data.get("title").toString()
theMessageDetail_ = remoteMessage.data.get("messageDetail").toString()
sendNotification(theMessageBody, theMessageTitle, theMessageDetail_)
}
//check if the message contains a notification payload
remoteMessage
.notification?.let {
theMessageBody = it.body!!
theMessageTitle = it.title!!
sendNotification(theMessageBody, theMessageTitle, theMessageDetail_)
}
}
感谢任何帮助..谢谢
【问题讨论】:
标签: android firebase android-studio firebase-cloud-messaging