gpt4 book ai didi

android - Cordova 推送通知未在 Android 上打开应用程序(窗口已经聚焦,忽略聚焦增益)

转载 作者:行者123 更新时间:2023-11-30 02:22:50 25 4
gpt4 key购买 nike

我正在尝试在 Cordova 应用程序中实现推送通知。我确实收到了推送通知,但是当我点击它们时没有任何反应。单击它时,我在 logcat 中看到以下消息:

I/ActivityManager(  746): START u0 {flg=0x10000000 cmp=xx.xxx.xx/jp.wizcorp.phonegap.plugin.localNotification.AlarmHelper (has extras)} from uid 10185 on display 0
W/InputMethodManagerService( 746): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@210f434 attribute=null, token = android.os.BinderProxy@9fef9f7

我正在使用以下插件进行推送通知 https://github.com/Wizcorp/phonegap-plugin-localNotifications

据我所知,这是相关部分:

// Create onClick for toast notification
Intent onClick = new Intent(context, AlarmHelper.class)
.putExtra(AlarmReceiver.NOTIFICATION_ID, notificationId);
// Create pending intent for onClick
PendingIntent contentIntent = PendingIntent.getActivity(context, 0, onClick, PendingIntent.FLAG_CANCEL_CURRENT);

// Build Notification
Notification notification = new Notification.Builder(context)
.setSmallIcon(bundle.getInt(ICON))
.setContentTitle(bundle.getString(TITLE))
.setContentText(bundle.getString(SUBTITLE))
.setTicker(bundle.getString(TICKER_TEXT))
.setContentIntent(contentIntent)
.setVibrate(new long[] { 0, 100, 200, 300 })
.setWhen(System.currentTimeMillis())
.build();

复制自here

最佳答案

我发现我必须在我的 AndroidManifest.xml 文件中包含 Intent 的 Activity 。添加此行解决了它。

<activity android:name="jp.wizcorp.phonegap.plugin.localNotification.AlarmHelper" />

始终确保您在 Intent 中引用的 Activity 已包含在您的 list 中。

关于android - Cordova 推送通知未在 Android 上打开应用程序(窗口已经聚焦,忽略聚焦增益),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28255044/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com