S Startup Active Member Licensed User Longtime User Aug 28, 2016 #1 I want to have my APP StartAtBoot. Erel says don't set StartAtBoot to True for the Starter module (which I use to create and initialize process variables). I am puzzled why that option is possible in the starter module template if it should not be used? (not meaning to be a wise guy just trying to see if I understand correctly). Also I see NJDude's StartAtBoot sample program has its StartAtBoot attribute in its Starter module set to True. I would like to use NJDude's sample APP to start my APP so I am thinking ... should I create a separate service module (say StartupService?) to incorporate the code in the starter module of NJDude's s sample program to comply with what Erel says to do? And if so should I have the line in NJDude's sample program ... i.SetComponent("njdude.startatboot.sample/.main") ... have .main replaced by .starter to have the program once started up then go immediately to the starter service ?
I want to have my APP StartAtBoot. Erel says don't set StartAtBoot to True for the Starter module (which I use to create and initialize process variables). I am puzzled why that option is possible in the starter module template if it should not be used? (not meaning to be a wise guy just trying to see if I understand correctly). Also I see NJDude's StartAtBoot sample program has its StartAtBoot attribute in its Starter module set to True. I would like to use NJDude's sample APP to start my APP so I am thinking ... should I create a separate service module (say StartupService?) to incorporate the code in the starter module of NJDude's s sample program to comply with what Erel says to do? And if so should I have the line in NJDude's sample program ... i.SetComponent("njdude.startatboot.sample/.main") ... have .main replaced by .starter to have the program once started up then go immediately to the starter service ?
Erel B4X founder Staff member Licensed User Longtime User Aug 29, 2016 #2 Startup said: I am puzzled why that option is possible in the starter module template if it should not be used? Click to expand... The IDE doesn't treat the starter service differently so it shows the same options. I'm not familiar with the sample program that you are referring to. You don't need any sample to use StartAtBoot. Just create another service and add #StartAtBoot: True. Upvote 0
Startup said: I am puzzled why that option is possible in the starter module template if it should not be used? Click to expand... The IDE doesn't treat the starter service differently so it shows the same options. I'm not familiar with the sample program that you are referring to. You don't need any sample to use StartAtBoot. Just create another service and add #StartAtBoot: True.
S Startup Active Member Licensed User Longtime User Aug 29, 2016 #3 Erel said: The IDE doesn't treat the starter service differently so it shows the same options. I'm not familiar with the sample program that you are referring to. You don't need any sample to use StartAtBoot. Just create another service and add #StartAtBoot: True. Click to expand... Thanks Erel! StartAtBoot does not start the APP if the APP has been previously closed as I understand it and in my experience. However, NJDude's sample (see this link) does. However, the sample program starts the program in the main module not the starter module so although the APP starts at boot when previously closed I don't get the variables set and initialized in the starter module when I use NJDude's sample. I suppose I can set the variables in the Main module but then I lose the benefit of using the starter module as the entry point. I want to start the APP at boot even if previously closed and be able to use the starter module as the entry point. Any suggestions how to do this much appreciated! (I tried changing NJDude's sample program replacing .main with .starter but that didn't work). Upvote 0
Erel said: The IDE doesn't treat the starter service differently so it shows the same options. I'm not familiar with the sample program that you are referring to. You don't need any sample to use StartAtBoot. Just create another service and add #StartAtBoot: True. Click to expand... Thanks Erel! StartAtBoot does not start the APP if the APP has been previously closed as I understand it and in my experience. However, NJDude's sample (see this link) does. However, the sample program starts the program in the main module not the starter module so although the APP starts at boot when previously closed I don't get the variables set and initialized in the starter module when I use NJDude's sample. I suppose I can set the variables in the Main module but then I lose the benefit of using the starter module as the entry point. I want to start the APP at boot even if previously closed and be able to use the starter module as the entry point. Any suggestions how to do this much appreciated! (I tried changing NJDude's sample program replacing .main with .starter but that didn't work).
Erel B4X founder Staff member Licensed User Longtime User Aug 30, 2016 #4 There is nothing special in that sample. It just sets StartAtBoot to true. As I previously wrote, you shouldn't start the starter service directly. Upvote 0
There is nothing special in that sample. It just sets StartAtBoot to true. As I previously wrote, you shouldn't start the starter service directly.
S Startup Active Member Licensed User Longtime User Sep 7, 2016 #5 Erel said: There is nothing special in that sample. It just sets StartAtBoot to true. As I previously wrote, you shouldn't start the starter service directly. Click to expand... Thanks Erel. You say there is nothing special in that sample (here is a link to it .. and I've repeated the code from the sample below) however I find that it starts the APP even when previously closed (which I want to do) while if I just have StartAtBoot to True (without this code) it does not start the APP (when previously closed). Is there something I'm missing here? Thanks! Note: Below is the code in the sample that I believe makes the APP start even if previously closed. Correct? Sub Service_Create Dim i As Intent i.Initialize("", "") i.SetComponent("b4a.CheckInRedo/.main") '<-- Replace this with the name of your package StartActivity(i) StopService("") End Sub Upvote 0
Erel said: There is nothing special in that sample. It just sets StartAtBoot to true. As I previously wrote, you shouldn't start the starter service directly. Click to expand... Thanks Erel. You say there is nothing special in that sample (here is a link to it .. and I've repeated the code from the sample below) however I find that it starts the APP even when previously closed (which I want to do) while if I just have StartAtBoot to True (without this code) it does not start the APP (when previously closed). Is there something I'm missing here? Thanks! Note: Below is the code in the sample that I believe makes the APP start even if previously closed. Correct? Sub Service_Create Dim i As Intent i.Initialize("", "") i.SetComponent("b4a.CheckInRedo/.main") '<-- Replace this with the name of your package StartActivity(i) StopService("") End Sub
Erel B4X founder Staff member Licensed User Longtime User Sep 7, 2016 #6 Please use [code]code here...[/code] tags when posting code. I don't see anything special in that code that will cause the standard OS enforced behavior to change. However if you want you can add this intent to your code. It is equivalent to calling StartActivity(Main). Upvote 0
Please use [code]code here...[/code] tags when posting code. I don't see anything special in that code that will cause the standard OS enforced behavior to change. However if you want you can add this intent to your code. It is equivalent to calling StartActivity(Main).
S Startup Active Member Licensed User Longtime User Sep 7, 2016 #7 Erel said: Please use [code]code here...[/code] tags when posting code. I don't see anything special in that code that will cause the standard OS enforced behavior to change. However if you want you can add this intent to your code. It is equivalent to calling StartActivity(Main). Click to expand... Thank you that's much better. I replaced that sample code with StartActivity(Main) and it works fine and has the added advantage of being simpler and something I actually understand . One more question: You said in another post (link here) "Make sure not to kill the app as it will prevent it from starting (don't swipe it from the recent apps list)." But my APP does StartAtBoot when previously closed (which I want it to do). So I'm not sure what you mean unless there are different devices or android versions where what works for me here won't work? Thanks! Upvote 0
Erel said: Please use [code]code here...[/code] tags when posting code. I don't see anything special in that code that will cause the standard OS enforced behavior to change. However if you want you can add this intent to your code. It is equivalent to calling StartActivity(Main). Click to expand... Thank you that's much better. I replaced that sample code with StartActivity(Main) and it works fine and has the added advantage of being simpler and something I actually understand . One more question: You said in another post (link here) "Make sure not to kill the app as it will prevent it from starting (don't swipe it from the recent apps list)." But my APP does StartAtBoot when previously closed (which I want it to do). So I'm not sure what you mean unless there are different devices or android versions where what works for me here won't work? Thanks!
Erel B4X founder Staff member Licensed User Longtime User Sep 7, 2016 #8 The behavior depends on the Android version. There were versions where applications couldn't implicitly start if the user has killed them. Upvote 0
The behavior depends on the Android version. There were versions where applications couldn't implicitly start if the user has killed them.
S Startup Active Member Licensed User Longtime User Sep 7, 2016 #9 Erel said: The behavior depends on the Android version. There were versions where applications couldn't implicitly start if the user has killed them. Click to expand... OK. Got it. Thanks! Upvote 0
Erel said: The behavior depends on the Android version. There were versions where applications couldn't implicitly start if the user has killed them. Click to expand... OK. Got it. Thanks!