Help: My service is not starting!

Mark Read

Well-Known Member
Licensed User
Longtime User
I know it must be something simple but I cannot get my service to start at all.
Have tried emulator and LG990 - no luck. I cannot see the problem.

Could someone please look at the code and tell me where I am going wrong. I have included the whole project as a zip file.

Many thanks.
Mark
 

Attachments

  • ParCon.zip
    93.2 KB · Views: 144

walterf25

Expert
Licensed User
Longtime User
Service won't start

for starters this part is wrong

B4X:
TimeSet =  td.Hour * DateTime.TicksPerHour + td.Minute * DateTime.TicksPerMinute

you should add the current time like this

B4X:
dim today as long
today = DateTime.DateParse(DateTime.Date(DateTime.Now))
TimeSet = today + td.Hour * DateTime.TicksPerHour + td.Minute * DateTime.TicksPerMinute

otherwise the time you're setting is way off and that's why the service won't start at the set time!

hope this helps!
 
Upvote 0

walterf25

Expert
Licensed User
Longtime User
Service won't start

But you are right it won't start, I got this in the unfiltered logs

Unable to start service Intent { flg=0x4 cmp=mr.parcon.app/.stopnet (has extras) }: not found

Cheers!
 
Upvote 0

Mark Read

Well-Known Member
Licensed User
Longtime User
Solved - I should read more!

@Walterf25,

thanks for your help. there were two problems stopping the app.
1. I had do not overwrite manifest clicked (due to flight mode) and then added a service, can't work!

2. The service reads the times from a file into a map. Forgot to open the file, hence your error.

The main problem was that I had no error, nothing, the service just didn't start. After correcting problem 1, I got your error and was able to solve it.

I am not finished but its getting there.
Thanks again for your help

ps. The variable "TimeSet" is actually only used to populate the label. The time is calculated in the sub ParseDates and is correct.
B4X:
TimeSet =  td.Hour * DateTime.TicksPerHour + td.Minute * DateTime.TicksPerMinute

Best regards
Mark
 
Upvote 0
Top