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

Open different controller from notification on android

$
0
0

Hello, I have this problem:

When users click on notification, my app should open specific controller(I am using alloy)but i can not make it.

here is my code for notification:

var notification = Titanium.Android.createNotification({
 
    var notification = Titanium.Android.createNotification({
        contentTitle: Title',
        contentText : 'Text,
        number: 5,
        when: new Date().getTime()
    });
 
    var intent = Ti.Android.createIntent({
        action: Ti.Android.ACTION_MAIN,
        className : 'my.app.id.offerActivity',
        packageName : 'my.app.id',
        flags : Ti.Android.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Ti.Android.FLAG_ACTIVITY_SINGLE_TOP 
    });
 
    intent.addCategory(Titanium.Android.CATEGORY_LAUNCHER);
    intent.putExtra('dealId' , '101');
 
    var pending = Ti.Android.createPendingIntent({
        intent : intent,
        type : Ti.Android.PENDING_INTENT_FOR_ACTIVITY,
        flags : Ti.Android.FLAG_ACTIVITY_NO_HISTORY
    });
 
    notification.contentIntent = pending;               
    Ti.Android.NotificationManager.notify(1, notification);
and here is what i add to tiapp.xml android part:
<activity android:configChanges="keyboardHidden|orientation|screenSize"
                    android:alwaysRetainTaskState="true"
                    android:label="Offer"
                    android:name=".offerActivity"
                    android:theme="@style/Theme.Titanium"
                    android:launchMode="singleTop">
                            <intent-filter>
                                <action android:name="android.intent.action.MAIN"/>
                                <category android:name="android.intent.category.LAUNCHER"/>
                        </intent-filter>
                </activity>
            </application>
But it do not open "offer" controller, it opens last controller(a.k.a window) which was opened in app.

Any ideas how to open controller(window) which i need?


Viewing all articles
Browse latest Browse all 8068

Trending Articles



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