2015-01-31 3 views
1

Я пытаюсь реализовать Push-уведомления в приложении Cordova. Я получаю push-уведомления, но ничего не происходит, когда я нажимаю на них. я вижу следующее сообщение в LogCat при нажатии на него:Кордова Push Notification не открывается приложение на Android (окно уже сфокусировано, игнорируя усиление фокуса)

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$[email protected] attribute=null, token = [email protected] 

Я использую следующий плагин для уведомления толчка 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

ответ

1

я обнаружил, что я должен был включать в себя деятельность намерения в моих AndroidManifest.xml файл. Добавление этой линии позволило решить эту проблему.

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

Всегда следите за тем, чтобы вы ссылались на деятельность в намерении, которое оно включено в ваш манифест.

Смежные вопросы