B4J Question B4J: allow to start single app copy only

Erel

B4X founder
Staff member
Licensed User
Longtime User
It is not trivial. You have three options:
- Try to open a specific network port when your app starts. If it fails then another instance of your app is already running.
- Create a temporary file when your app starts. If it already exists then there is another instance running. The problem is that if your app crashes or the computer is turned off while your program is running the file will not be deleted. So you can implement a more sophisticated solution that saves the time to a file every x minutes. You can then check whether this is an old file.
- On Windows you can use a solution such as Luanch4j to create an executable. It also allows you to allow only a single instance.
 
Upvote 0
Top