Quantcast
Channel: Appcelerator Developer Center Q&A Unanswered Questions 20
Viewing all articles
Browse latest Browse all 8068

Push notification unable to send Extra Intent ( Android )

$
0
0

Hello

I've problem with send/receive Extra intent , when i send push notification and use click on it application should open with alert dialog ( notification text content )

this is push notification code

var intent = Ti.Android.createIntent({ flags : Ti.Android.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Ti.Android.FLAG_ACTIVITY_SINGLE_TOP, // className:'com.dowgroup.pushapps.PushAppsActivity', action : Ti.Android.ACTION_MAIN, url : 'app.js', }); intent.addCategory(Ti.Android.CATEGORY_LAUNCHER); //intent.putExtra(Ti.Android.EXTRA_TEXT, "notification"); intent.putExtra("test", "test"); intent.putExtra('interval', 5000); intent.putExtra('timestamp', new Date(new Date().getTime() + 30 * 1000));

        var activity = Ti.Android.currentActivity;

        // Create a PendingIntent to tie together the Activity and Intent
        var pending = Titanium.Android.createPendingIntent({
                      intent : intent,
                      activity:activity,
                      flags : Titanium.Android.FLAG_UPDATE_CURRENT
                      });
        // Create the notification
        var notification = Titanium.Android.createNotification({
            // icon is passed as an Android resource ID -- see Ti.App.Android.R.
            icon: Ti.App.Android.R.drawable.appicon,
            flags : Titanium.Android.ACTION_DEFAULT | Titanium.Android.FLAG_AUTO_CANCEL | Titanium.Android.FLAG_SHOW_LIGHTS,
            contentTitle: e.data.title,
            contentText:e.data.message,
            contentIntent : pending,
            tickerText : e.data.ticker,
            defaults:Ti.Android.NotificationManager.DEFAULT_SOUND
        });
        // Send the notification.
        Titanium.Android.NotificationManager.notify(e.data.pushid, notification);
        alert(e.data.message); 

and this is app.js

var act = Titanium.Android.currentActivity;

alert("-- ---= "+JSON.stringify(act));

the problem is data become Null , i can't catch ( test ) or any extra object key send

any advice ?


Viewing all articles
Browse latest Browse all 8068

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>