0

Ionic/AngularJS アプリを作成し、プッシュ通知に PushPlugin を使用しています。アプリ内で通知を受け取ると、それを受け取り、すべて正常に機能します。

しかし、アプリの外にいて、通知バーに通知を受け取り、それをタップすると、ログ ファイルに次のように表示されます。

  07-01 10:56:51.651: W/ActivityManager(3037): java.lang.SecurityException: 
  Permission Denial: starting Intent { flg=0x24000000 cmp=za.co.vine.gcom.phonegap.test/com.plugin.gcm.PushHandlerActivity bnds=[0,1021][1080,1213] (has extras) } from null (pid=-1, uid=10261) not exported from uid 10275
  07-01 10:56:51.651: W/ActivityManager(3037):  at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:1669)
  07-01 10:56:51.651: W/ActivityManager(3037):  at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:977)
  07-01 10:56:51.651: W/ActivityManager(3037):  at com.android.server.am.ActivityManagerService.startActivityInPackage(ActivityManagerService.java:4182)
  07-01 10:56:51.651: W/ActivityManager(3037):  at com.android.server.am.PendingIntentRecord.sendInner(PendingIntentRecord.java:252)
  07-01 10:56:51.651: W/ActivityManager(3037):  at com.android.server.am.PendingIntentRecord.send(PendingIntentRecord.java:192)
  07-01 10:56:51.651: W/ActivityManager(3037):  at android.content.IIntentSender$Stub.onTransact(IIntentSender.java:64)
  07-01 10:56:51.651: W/ActivityManager(3037):  at android.os.Binder.execTransact(Binder.java:404)
  07-01 10:56:51.651: W/ActivityManager(3037):  at dalvik.system.NativeStart.run(Native Method)

phonegap build を使用してアプリをビルドします - バージョン 3.4.0

AndroidManifest フィールドに export=true を追加することを提案する人もいますが、Phonegap ビルドではそれを行うことができません。

LogCat からのいくつかのログ行:

  07-02 11:11:41.846: V/GCMBroadcastReceiver(29009): onReceive: com.google.android.c2dm.intent.RECEIVE
  07-02 11:11:41.851: V/GCMRegistrar(29009): Setting the name of retry receiver class to com.plugin.gcm.CordovaGCMBroadcastReceiver
  07-02 11:11:41.851: V/GCMBroadcastReceiver(29009): GCM IntentService class: com.plugin.gcm.GCMIntentService
  07-02 11:11:41.851: V/GCMBaseIntentService(29009): Acquiring wakelock
  07-02 11:11:41.871: V/GCMBaseIntentService(29009): Intent service name: GCMIntentService-GCMIntentService-1
  07-02 11:11:41.876: D/GCMIntentService(29009): onMessage - context: android.app.Application@42a90348
  07-02 11:11:41.896: W/ApplicationPackageManager(29009): getCSCPackageItemText()
  07-02 11:11:41.931: V/GCMBaseIntentService(29009): Releasing wakelock

そして、これは私の onNotificationGCM コードです:

  onNotificationGCM = function(e) {
    console.log("gvi.Notifications:onNotificationGCM");

    switch( e.event ) {
        case 'registered':
            if ( e.regid.length > 0 ) {
                // Your GCM push server needs to know the regID before it can push to this device
                // here is where you might want to send it the regID for later use.
                if (self.debug) console.log( 'registration id = '+e.regid );
                pushRegisterSuccessCB( e.regid );
            }
        break;

        case 'message':
            // this is the actual push notification. its format depends on the data model
            // of the intermediary push server which must also be reflected in GCMIntentService.java
            console.log(e);
            if (self.debug) {
                console.log( 'message' );
                console.log( e );

            }
            _retrieveMessages();

            //alert('message = '+e.message+' msgcnt = '+e.msgcnt+' msgid = '+e.msgid+' type = '+e.type);
            if ( e.foreground ) {
                console.log( 'foreground' );

                //var my_media = new Media("/android_asset/www/"+e.soundname);
                //my_media.play();
            }
            else   // otherwise we were launched because the user touched a notification in the notification tray.
            if (e.coldstart) {
                console.log( 'coldstart' );

            }
            else {
                console.log( 'background' );

            }
        break;

        case 'error':
          alert( 'GCM error = '+e.msg );
        break;

        default:
          alert( 'An unknown GCM event has occurred' );
          break;
    }
};

そして _retrieveMessages 関数:

  _retrieveMessages = function() {
    if (self.debug) console.log( "gvi.Notifications:_retrieveMessages" );

    if ( window.device !== undefined ) {
        //self._platform = device.platform === undefined? self._platform: device.platform;
        self._uuid = device.uuid === undefined? self._uuid: device.uuid;
        self._model = device.model === undefined? self._model: device.model;
        self._version = device.version === undefined? self._version: device.version;
    }

    _ajaxGet("/cloudMessaging/Register?" +
              "action=retrieve" +
              "&appid=" + self._appKey +
              "&secretkey=" + self._appSecret +
              "&deviceid=" + self._uuid +
              "&recdate=" + new Date().getTime(),
              _retrieveMessageSuccessCB, 
              function (statusCode, json) {if (self.debug) console.log("_sendReceipt:ERR:" + statusCode +" :"+ JSON.stringify(json, null, 2) )});
};

また、人々が phonegap 2.9 にダウングレードすると機能することも確認しましたが、私はそうしたくありません。どうすればこれを修正できますか?

4

0 に答える 0