我有firebase消息服务代码,其中检查通知标题,如果它包含某些文本&在webview中的某个页面上,它显示Toast&刷新页面。
现在问题是我要删除下面的行,我称之为文本过滤器:
get_1st_layer_output = K.function([model.layers[0].input],
[model.layers[1].output])
layer_output = get_1st_layer_output([X])
有谁可以告诉如何修改下面的代码?
if (title.contains("Added")) {
答案 0 :(得分:0)
试试这个:
if(MainActivity.mWebview.getUrl().contains("http://example.com")) {
Handler handler = new Handler(Looper.getMainLooper());
handler.post(
new Runnable() {
@Override
public void run() {
Log.d("webUrl",""+MainActivity.mWebview.getUrl());
Toast.makeText(FcmMessagingService.this, message, Toast.LENGTH_SHORT).show();
MainActivity.reLoad();
}
});
} else {
Intent intent = new Intent(this, MainActivity.class);
intent.putExtra("value", "kh");
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, intent, PendingIntent.FLAG_ONE_SHOT);
Uri sounduri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this);
notificationBuilder.setContentTitle(title);
notificationBuilder.setContentText(message);
notificationBuilder.setSmallIcon(R.mipmap.ic_icon);
notificationBuilder.setSound(sounduri);
notificationBuilder.setAutoCancel(true);
notificationBuilder.setContentIntent(pendingIntent);
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancel(0);
notificationManager.notify(0, notificationBuilder.build());
}