TNS App Instance

nativescriptcore

#1

Hi all,
am using {N}-local-notifications in my App, when i click the notification the App opens Fine! but if i press the “Home” button App minimises Fine! but if i go to the App drawer and click the App to “resume”, it actually opens another App instance while the previous one is back grounded hogging system resources even more!. then to isolate the {N}-local-notification, if i start the App from the drawer(duh!) that works as expected and if i press “home” to suspend a.k.a minimise, then try to resume from drawer not from “recents” it opens another App instance!! :disappointed_relieved::roll_eyes: am on tns-core 3.3.0, tns-Android 3.2.0


#2

Sounds like a mess! @eddy do you have any idea what might be causing some of these issues in local notifications?


#3

Perhaps it has something to do with the launchMode of your main activity. Open App_Resources/Android/AndroidManifest.xml and check if there’s a `<activity android:launchMode=“something” …> property.

Play around with that property. Possible options are “standard” | “singleTop” | “singleTask” | “singleInstance” … if none of those make a difference let me know and I’ll dig deeper.


#4

OK @Eddy will try and revert back with an answer


#5

@eddy "android:launchMode=“singleTop” inside the activity tag was all that
was needed! It didn’t exist I added it! Thanks @eddy


#6

Awesome! I was just about to add that to the readme and noticed it’s already there :joy:


#7

@Eddy in relation to {N}-local-notifications, how can i show notification immediately, the best i get is 10 seconds, which comes after vibration, i use it in my chat section of my App and as push notifications from back-end service !