Android Question start app after restart in b4a

mhk1368

Member
hi
I want my app to come up automatically after restarting or turning on the phone , and it is not possible for the user to close or minimize it. How can I do this? Do I need to write a separate service for this or can I do this in my app's service program?
 

jahswant

Well-Known Member
Licensed User
Longtime User

Follow this tutorial carefully.
 
Upvote 0

teddybear

Well-Known Member
Licensed User
hi
I want my app to come up automatically after restarting or turning on the phone , and it is not possible for the user to close or minimize it. How can I do this? Do I need to write a separate service for this or can I do this in my app's service program?
You can start your app after phone is boot_completed, but it is impossible to prevent users from clsoing or minimizing your app.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
but it is impossible to prevent users from clsoing or minimizing your app
Not 100% correct. If you use the deviceowner/tasklock-method you can.
 
Upvote 0

labcold

Member
Licensed User
Longtime User
Not 100% correct. If you use the deviceowner/tasklock-method you can.
I have a smart watch app for security running for three years as a commercial system with hundreds of users (android 7.1.1), but still the issue of what is a locked app and home app still arises. Regularly users report that the device is asking for what apk to use for home when its 1) already set as home in settings, 2) device owner lock is set, 3) the application is pinned - when I get them back for analysis the home apk is reset to android default. Using external buttons also seems to cause the pinned state to change. SMS messages tend to cause issues so I run an intercept service for those which helps but they still get cell broadcast which can force the lock to break. Phone calls is another and advertising and scams are using this more and more - again I trap these now as well.

Another thing that has surfaced recently (since moving to Java11 from Java8) is that the B4A app Activity_Create seems to get called twice within a short time on startup (FirstTime = true then FirstTime = false with attendant app resumes) the second seems to interrupt the FirstTime run through the code - hence I have had to shorten the process in FirstTime to stop the app hanging.

All in all the lock process using AnywhereSoftware AdminReceiver does work but beware its not fool proof and there are plenty of fools out there.

It is a great pity that there isnt a more robust way of controlling vanilla Android and stopping all the processes you dont want to interfere from causing problems. Obviously your own branch would be nice but most manufacturers wont share their versions - mainly as they dont really own the code or dont understand how it is configured - and believe me we have tried to get this even commercially and getting the real schematic and drivers for the devices is equally fruitless.

I'm seriously thinking about crowd funding a good simple smart device running Android 5 or above like the LEMFO LEM10. Without all the unnecessary background processes, none of the pointless built in applications and proper control over things like setting the APN and other cell features I'm sure a B4A ready clean slate would solve many problems with good battery life and solid operation.

Still at least we all have the benefit of the superb B4A which makes light work of rapid app development and is way more efficient than building native and its 95%+ solid across the board :O :D
 
Upvote 0
Top