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

How do you get the intent of an Activity?

$
0
0

I am making an android app in titanium and I was wondering how to get the Intent of that activity so I can get the extra information of the intent (I have used Intent.putExtra in the intent). The activity is started from a notification which is why I am using an activity. Here is the code for the intent and the code where the error occurs.

Tips.js

if(Ti.Android.Activity.intent.hasExtra('Tip')){ //error occurs here
    initTip = Ti.Android.Intent.getStringExtra('Tip');
}
Service.js
var intent = Ti.Android.createIntent({
    action : Ti.Android.ACTION_VIEW,
    url : '/Tips.js',
    flags :Ti.Android.FLAG_ACTIVITY_SINGLE_TOP | Ti.Android.FLAG_ACTIVITY_NEW_TASK
});
intent.addCategory(Titanium.Android.CATEGORY_LAUNCHER);
intent.putExtra('Tip',tip);
 
var pending = Titanium.Android.createPendingIntent({
       intent: intent,
       type : Ti.Android.PENDING_INTENT_FOR_ACTIVITY,
       flags : Ti.Android.FLAG_ACTIVITY_NO_HISTORY,
});
 
 
Titanium.Android.NotificationManager.notify( 0,
    Ti.Android.createNotification({
        contentTitle: 'Tip',
        contentText: tip,
        tickerText: 'Quick Tip',
        contentIntent: pending
    })
);

Viewing all articles
Browse latest Browse all 8068

Trending Articles



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