2012-04-27 14 views
0

私のプロジェクトにはC2DM Module(AndroidのCloud to Device Messaging Framework)が正常に組み込まれ、Androidプッシュ通知を正常に登録して受信できました。しかし、通知を送信するたびに、新しい通知がデバイスに表示されないことに気付きました。 今日、デバイスを接続し、adb logcatを使用し、IntentService [c2dmBaseReceiver]が実際に起動され、私が送信したメッセージを受信したことに気付きましたが、コールバック関数はV8ランタイムが破棄されたためlogcatからライン)C2DM受信中にAppcelerator Titanium V8ランタイムが廃棄される

D/C2DMReceiver(1069): (IntentService[C2DMBaseReceiver]) [369956,441456] Message received 
D/C2DMReceiver(1069): (IntentService[C2DMBaseReceiver]) [1,441457] Message key: message value: This is a test notification 
D/C2DMReceiver(1069): (IntentService[C2DMBaseReceiver]) [0,441457] Message key: title value: myAppName 
D/C2DMReceiver(1069): (IntentService[C2DMBaseReceiver]) [2,441459] Message key: tickerText value: Notification Ticker 
D/C2DMReceiver(1069): (IntentService[C2DMBaseReceiver]) [1,441460] Message key: from value: [email protected] 
D/C2DMReceiver(1069): (IntentService[C2DMBaseReceiver]) [0,441460] Message key: collapse_key value: myApp Alert 
W/V8Function(1069): Runtime disposed, cannot call function 

これは私のコールバック

callback:function(e) 
{ 
    Ti.API.info('JS message event: ' + JSON.stringify(e.data)); 
    var intent = Ti.Android.createIntent({ 
     action: Ti.Android.ACTION_MAIN, 
     flags: Ti.Android.FLAG_ACTIVITY_NEW_TASK | Ti.Android.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED, 
     className: 'com.avivas.myApp.myAppActivity', 
     packageName: 'com.avivas.myApp' 
    }); 

    intent.addCategory(Ti.Android.CATEGORY_LAUNCHER); 

    var pending = Ti.Android.createPendingIntent({ 
     activity: Ti.Android.currentActivity, 
     intent: intent, 
     type: Ti.Android.PENDING_INTENT_FOR_ACTIVITY, 
    }); 

    var notification = Ti.Android.createNotification({ 
     contentIntent: pending, 
     contentTitle: e.data.title, 
     contentText: e.data.message, 
     tickerText: e.data.tickerText 
    }); 

    Ti.Android.NotificationManager.notify(1, notification); 

    Titanium.Media.vibrate([0,300, 100, 300]); 
} 

である私は、C2DMからのコールバック関数がJavaScriptであるため、V8ランタイムが配置されているため、それが実行できないことを想定しています。 これを確認できる人はいますか?さらに、私はそれを受け取ったときに通知を表示したいので、これに対する任意の回避策がありますか?

答えて

0

Rhinoエンジンで正常に動作します。

関連する問題