3

In simple Java application, if we open it 2 times, 2 app instances will be launched.

AFAIK there are some ways to limit single instance for Java app such as: using FileLock to lock a RandomAccessFile & add shutdown hook to release it later when app is shutting down,..

But how it WAS implemented in Android app? Because in Android, when users click on app's icon while this app is running the Android system shows the old app instance rather than creating a new one.

nhoxbypass
  • 9,695
  • 11
  • 48
  • 71
  • To be clear you are talking about Application instance and not [Tasks and Back Stack](https://developer.android.com/guide/components/activities/tasks-and-back-stack) which relates to Activities. – Morrison Chang Jun 11 '18 at 07:13
  • @MorrisonChang Yes! I'm mentioning Android app instance. – nhoxbypass Jun 11 '18 at 07:33
  • You might want to do a bit of research into Android internals like Zygote. While dated, it may helpful to watch the early Google IO videos from 2008: [Google I/O 2008 - Anatomy and Physiology of an Android](https://youtu.be/G-36noTCaiA?t=43m10s) And if you are still looking further, remember that the source code for Android is open source: https://source.android.com/ – Morrison Chang Jun 11 '18 at 08:40

0 Answers0