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

Open a custom page in my app from a notification

$
0
0

Hello,

I want to open a certain page of my app from a notification send by a service of my app. The behaviour is similar as what happens with WhatsApp, when you click on a notificiation from whatsapp, you get redirected to the chat session the notification is from. I also want to send the user to a certain page (not the startpage of my app) when they click on the notification.

I already got the code to start the app from a notification, shown below:

var intent = Titanium.Android.createIntent({
    action: Titanium.Android.ACTION_MAIN,
    className: 'doc.lol.LolActivity', 
    packageName: 'doc.lol'
});
 
intent.addCategory(Titanium.Android.CATEGORY_LAUNCHER);
 
var pending = Titanium.Android.createPendingIntent({
    activity: Titanium.Android.currentActivity,
    intent: intent,
    type: Titanium.Android.PENDING_INTENT_FOR_ACTIVITY, 
    flags: Titanium.Android.FLAG_ACTIVITY_NEW_TASK
});
 
var notification = Titanium.Android.createNotification({
    contentIntent: pending,
    contentTitle: 'A Notification',
    contentText: 'Time to feed the cat ...',
    tickerText: "Feeding time ...",
    when: new Date().getTime()
});
 
Ti.Android.NotificationManager.notify(1, notification);
Actually i dont have a f...ing clue about what i am doing, i just copy pasted it from some other question and was glad i finaly got some s.ht working after hours of trying.

So now it just opens a new instance of the app i think, which is no problem, but i'd like it to open the app on a certain start window, not the main window. How should i handle this?

I hope someone can help me on this.

Hylke Bron


Viewing all articles
Browse latest Browse all 8068

Trending Articles



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