【发布时间】:2017-12-29 02:20:56
【问题描述】:
我有一个 Webview 和 例如 : 字符串 url = "https://www.google.com"; 网址加载(网址); 在我的应用中显示 Google,
好的,如果我收到通知并推送, Webview 将更改页面。
就像字符串 url = 通知的正文;
对不起,我的英语不好。
谢谢。
ps。我正在使用 Xamarin
这是 FCM 接收
[服务]
[IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" })]
class Firebasemessaging : FirebaseMessagingService
{
public override void OnMessageReceived(RemoteMessage message)
{
this.SendNotification(message.GetNotification().Body);
Notification notifi = new
Notification(Resource.Drawable.pika,"Handbim");
}
private void SendNotification(string body)
{
var intent = new Intent(this, typeof(MainActivity));
intent.AddFlags(ActivityFlags.ClearTop);
var pendingIntent = PendingIntent.GetActivity(this, 0, intent, PendingIntentFlags.OneShot);
var defaultsoundUri = RingtoneManager.GetDefaultUri(RingtoneType.Notification);
var notif = new NotificationCompat.Builder(this)
.SetContentTitle("handbim")
.SetContentText(body)
.SetAutoCancel(true)
.SetSound(defaultsoundUri)
.SetContentIntent(pendingIntent);
var notificationManager = NotificationManager.FromContext(this);
notificationManager.Notify(0,notif.Build());
}
}
【问题讨论】:
-
你的意思是你会收到FCM的通知,然后你会得到通知的正文,然后你会在
WebView上显示正文的内容?您的问题对我们来说不是很清楚。 -
是的,所以正文的内容是一个 URL