Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you prevent an Android Wear activity from having multiple instances?

Sometimes, most of the time when my LG G watch closes the app automatically by going to sleep/dim mode, if I open the app again by going to the start menu there are two instances of the activity opened (when I slide one off the previous one is underneath).

This never happens in a phone, is this how activities work in Android Wear? Should I "finish()" them in onPause()?

Thanks.

like image 249
SoftwareDev Avatar asked Oct 21 '22 03:10

SoftwareDev


1 Answers

Have you looked at the android:launchMode attribute in the AndroidManifest.xml for the activity?

perhaps android:launchMode="singleInstance" will help you out.

http://developer.android.com/guide/topics/manifest/activity-element.html#lmode

like image 187
r2DoesInc Avatar answered Oct 23 '22 03:10

r2DoesInc