Android Question Application with widget that not run at boot

laviniut

Active Member
Licensed User
Longtime User
I have an application with widget that monitors battery voltage. The old version has a widget with run at boot setting and it works. It was maded with on old version of B4Android. Now i made minor modification and i build it with B4Android 7.3 and it not run automatically at boot. Now it has a starter module. I set run at boot setting to false and to true in starter module, but nothing helps. Not running at boot. Widget module is the same. I use this attributes in widget service:
B4X:
#Region  Service Attributes
    #StartAtBoot: True
    #StartCommandReturnValue: android.app.Service.START_STICKY
#End Region
Application is tested on android 7.1.1
Why is that?
 
Last edited:

DonManfred

Expert
Licensed User
Longtime User
and to true in starter module
Do not use the starter service for this.

You can use any service for this. Just set this setting only to this service.

Note the Comments in the starter tutorial.

Notes

  • The Starter service is identified by its name. You can add a new service named Starter to an existing project and it will be the program entry point.
  • This is an optional feature. You can remove the Starter service.
  • You can call StopService(Me) in Service_Start if you don't want the service to keep on running. However this means that the service will not be able to handle events (for example you will not be able to use the asynchronous SQL methods).
  • The starter service should be excluded from compiled libraries. Its #ExcludeFromLibrary attribute is set to True by default.
  • The starter service should never be explicitly started. This means that if you want to start a service at boot then add a different service.
 
Upvote 0

laviniut

Active Member
Licensed User
Longtime User
Do you mean to delete the starter service? I set starter attributes run at boot to false and widget service run at boot to true. But is not working. Not run at boot. Maybe is needed some setting in manifest editor for android 7 to run in background and run at boot?
 
Upvote 0

laviniut

Active Member
Licensed User
Longtime User
I set B4A to work with android 25 and now is starting at boot. I tested on my android 7 tablet. Also i think my phone don't let automatically an application to start at boot.
 
Upvote 0

laviniut

Active Member
Licensed User
Longtime User
Something else bothers me now. When application service start at boot, a message in status bar appear and say that application started and you can view other information about application. But i can not delete this message. If i start the application than message disappear automatically. Why is that?
 
Upvote 0

laviniut

Active Member
Licensed User
Longtime User
After a phone boot i get this message and i can't delete it. If i start application once, the message is gone. My app with widget is Battery monitoring 3.
 

Attachments

  • 2017-10-10-23-53-42.jpg
    2017-10-10-23-53-42.jpg
    336 KB · Views: 209
Upvote 0

laviniut

Active Member
Licensed User
Longtime User
I understand. I only set run at boot feature at widget module. But my problem is I can't delete the message that appears.
 
Upvote 0

laviniut

Active Member
Licensed User
Longtime User
Ok. But in my app to put the widget on screen is optional. If widget is not put on screen, than widget is starting automatically?
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
than widget is starting automatically?
No. There is no need to start the widget service manually.....
IF it is placed on the desktop then it will be launched automatically by the launcher-app

If the widget is not on the desktop then the service will not start
 
Upvote 0
Top