Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android statusbar notification launches new app though it running already. How to synchronize launching app from app icon and staus bar notification?

I have implemented notification within service. Notification works fine. But in the case when app is running already and I clicked on android status bar notification it launches new copy of my app. which is obviously wrong. It should be if user click on status bar notification, should start app if app is not running already otherwise it should opens other activity (message activity in my case). I tried many suggestions provided in similar type of problem posted here but I didn't get solution in my case.

like image 319
Krishna Shrestha Avatar asked Oct 20 '11 04:10

Krishna Shrestha


1 Answers

How about setting the launchMode to SingleInstance in the app's manifest.

There's also the trick I picked up on here about having a special NotificatonActivity that the notification calls:

Notification to restore a task rather than a specific activity?

like image 80
MikeHelland Avatar answered Nov 11 '22 23:11

MikeHelland