Cordova Push Notification not opening App on Android(Window 已经聚焦,忽略聚焦增益)
Cordova Push Notification not opening App on Android (Window already focused, ignoring focus gain of)
我正在尝试在 Cordova 应用程序中实现推送通知。我确实收到了推送通知,但是当我点击它们时没有任何反应。
单击 logcat 时,我在 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 时它都包含在您的清单中。
我正在尝试在 Cordova 应用程序中实现推送通知。我确实收到了推送通知,但是当我点击它们时没有任何反应。 单击 logcat 时,我在 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 时它都包含在您的清单中。