2015-07-20 2 views
0

У меня есть интегрированное учебное приложение для push-уведомлений с моим Android-проектом. Перед двумя проблемами с приложением.Push Notification не receeied на эмуляторе с использованием IBM MobileFirst

Выпуск 1: Мое приложение регистрирует широковещательное уведомление о передаче. И при вызове адаптера для отправки широковещательного уведомления, когда приложение находится на переднем плане, оно отлично работает. Когда я нажимаю домашний ключ, а затем вызываю адаптер для уведомления о широковещательном уведомлении, уведомление не появляется на эмуляторе Android. Ниже показана ошибка в logcat. Похоже, что GCM вытолкнул уведомление, но его не отправили клиенту.

07-20 06:40:21.748: V/GCMBroadcastReceiver(1899): onReceive: com.google.android.c2dm.intent.RECEIVE 
07-20 06:40:21.748: V/GCMBroadcastReceiver(1899): GCM IntentService class: com.FinacleMobileApp.GCMIntentService 
07-20 06:40:21.748: V/GCMBaseIntentService(1899): Acquiring wakelock 
07-20 06:40:21.789: V/GCMBaseIntentService(1899): Intent service name: GCMIntentService-DynamicSenderIds-2 
07-20 06:40:21.848: D/GCMIntentService(1899): GCMIntentService.onMessage in GCMIntentService.java:107 :: WLGCMIntentService: Received a message from the GCM server 
07-20 06:40:21.848: V/GCMBaseIntentService(1899): Releasing wakelock 
07-20 06:40:21.888: W/GCMIntentService(1899): GCMIntentService.onMessage in GCMIntentService.java:114 :: Unable to update badge while received push notification, becasue failed to parse badge number null, badge must be an integer number. 
07-20 06:40:21.918: D/GCMIntentService(1899): GCMIntentService.addToIntentQueue in GCMIntentService.java:147 :: WLGCMIntentService: App is on foreground but init is not comeplete. Queue the intent for later re-sending when app is back on foreground. 
07-20 06:40:21.748: V/GCMBroadcastReceiver(1899): onReceive: com.google.android.c2dm.intent.RECEIVE 
07-20 06:40:21.748: V/GCMBroadcastReceiver(1899): GCM IntentService class: com.FinacleMobileApp.GCMIntentService 
07-20 06:40:21.748: V/GCMBaseIntentService(1899): Acquiring wakelock 
07-20 06:40:21.789: V/GCMBaseIntentService(1899): Intent service name: GCMIntentService-DynamicSenderIds-2 
07-20 06:40:21.848: D/GCMIntentService(1899): GCMIntentService.onMessage in GCMIntentService.java:107 :: WLGCMIntentService: Received a message from the GCM server 
07-20 06:40:21.848: V/GCMBaseIntentService(1899): Releasing wakelock 
07-20 06:40:21.888: W/GCMIntentService(1899): GCMIntentService.onMessage in GCMIntentService.java:114 :: Unable to update badge while received push notification, becasue failed to parse badge number null, badge must be an integer number. 
07-20 06:40:21.918: D/GCMIntentService(1899): GCMIntentService.addToIntentQueue in GCMIntentService.java:147 :: WLGCMIntentService: **App is on foreground but init is not comeplete.Queue the intent for later re-sending when app is back on foreground. 

Выпуск 2: В одном приложении я пытаюсь зарегистрировать Tag (предложения) для уведомления. Я вызываю метод подписки для этого тега. Код выглядит следующим образом. Используется NototationCenter.js. когда я вызываю функцию subscribeForTagNotification (приведенную ниже) из моего приложения. Я получаю Cant Подписаться, токен уведомления не обновляется на сервере.

Пожалуйста, дайте мне знать, если я что-то упустил. Функция SubscribeforTagNotification вызывается сразу же после вызова соединения с сервером MF. Мое приложение использовало WL.client.init, чтобы установить соединение с connectOnStartUp как истинный.

AppController.factory('NotificationCenter', ['$http', '$rootScope', '$q', '$location', '$timeout', 
              function($http, $rootScope, $q, $location, $timeout) { 

    if (WL.Client.Push) { 
     WL.Logger.debug("Ganesh Notification center on ready to subscribe"); 
     //WL.Client.connect({onSuccess: connectSuccess, onFailure: connectFailure}); 
     WL.Logger.debug("Ganesh connection waiting complete"); 
     WL.Client.Push.onReadyToSubscribe = function() { 
     WL.SimpleDialog.show("Tag Notifications", "Ready to subscribe", [ { 
       text : 'Close', 
       handler : function() {} 
      } 
      ]); 

     }; 

    } 

    function doSubscribeSuccess() { 
     WL.Logger.debug("Ganesh doSubscribeSuccess"); 
     WL.SimpleDialog.show("Tag Notifications", "Subscribed to tag",[{ 
      text:'Close',handler :function(){} 
     }]); 
    } 

    function doSubscribeFailure() { 
     WL.Logger.debug("Ganesh doSubscribeFailure"); 
     WL.SimpleDialog.show("Tag Notifications", "Subscribed to tag",[{ 
      text:'Close',handler :function(){} 
     }]); 
    } 

    WL.Client.Push.onMessage = function (props, payload) { 
     WL.SimpleDialog.show("Tag Notifications", "Provider notification data: " + JSON.stringify(props), [ { 
      text : 'Close', 
      handler : function() { 
      WL.SimpleDialog.show("Tag Notifications", "Application notification data: " + JSON.stringify(payload), [ { 
       text : 'Close', 
       handler : function() {} 
       }]);  
      } 
     }]); 
    }; 

return { 

    init: function() { 

     }, 
    **subscribeForTagNotification:function()**{ 
        WL.Logger.debug("Ganesh doSubscribe feature"+WL.Client.Push.isTagSubscribed("OFFERS")); 
     if (WL.Client.Push && !WL.Client.Push.isTagSubscribed("OFFERS")) { 
       WL.Logger.debug("Ganesh doSubscribe feature entered"); 
       WL.Client.Push.subscribeTag("OFFERS", { 
        onSuccess: doSubscribeSuccess, 
        onFailure: doSubscribeFailure 
       }); 
      } 

     } 

    }; 

}]); 

IBM MobileFirst версия: 6.3.0.00-20141127-1357 Платформа: Android

ответ

0

Для уведомления Нажмите, чтобы работать на эмуляторе вам нужно иметь Target : Google API иначе он не будет работать на вас Emulator.

я надеюсь, что вы получите то, что я пытаюсь сказать, цель относится к AVD (Anddroid Virtual Target Device) для вашего созданного виртуального устройства.

+0

Иам с помощью Google API 17 в моем приложении. Я могу получать широковещательные уведомления, но сталкиваются с указанными проблемами только для определенных сценариев. –

+0

Проблема 1) Нативный слой получает уведомление и ставит его в очередь, так как приложение не находится на переднем плане. Вы не видите уведомление в тени уведомления? Выпуск 2) Вы пытаетесь подписаться, прежде чем «onReadyToSubscribe»? Есть ли вопрос времени? –

0

Если ваша организация имеет брандмауэр, который ограничивает трафик или из Интернета, необходимо пройти следующие этапы:

Configure the firewall to allow connectivity with GCM so that your GCM client apps can receive messages. The ports to open are 5228, 5229, and 5230. GCM typically uses only 5228, but it sometimes uses 5229 and 5230. GCM does not provide specific IP, so you must allow your firewall to accept outgoing connections to all IP addresses that are contained in the IP blocks listed in Google ASN of 15169. For more information, see Implementing an HTTP Connection Server. 

Ensure that your firewall accepts outgoing connections from MobileFirst Server to android.googleapis.com on port 443. 
Смежные вопросы