Android Question Service

omoba

Active Member
Licensed User
Longtime User
Hi,

I have created an app running a service that constantly checking day and time, at a preset day and time, the app should go to Main Activity to check data in a database.
If a certain conditions are met, I want a phone notification sent.

What I have noticed is this

at the preset time,
the app calls the sub in Main --CallSubDelayed(Main, "Calld")
the app checks the database and unfortunately even when the certain conditions are met, a notification is not sent; I get the notification only after I open the app again.

How do I get the phone to send the notification? I have tried sending the notification from the Calld Sub but that didnt work. I also tried it from the service no luck either.

Also, do I have to call the service again after checking data in the database?

Thank you
 

Attachments

  • DBUtils.zip
    33.5 KB · Views: 103
Last edited:

barx

Well-Known Member
Licensed User
Longtime User
Its a little hard to tell you what you are doing wrong without seeing your code. Also probably not a good idea to keep a service active constantly just to check the time. Why not use StartServiceAt()
 
Upvote 0

omoba

Active Member
Licensed User
Longtime User
Its a little hard to tell you what you are doing wrong without seeing your code. Also probably not a good idea to keep a service active constantly just to check the time. Why not use StartServiceAt()

I have updated my post with my app --it sure needs some cleanup
 
Upvote 0

omoba

Active Member
Licensed User
Longtime User
CallSubDelayed will not start the activity if the app is in the background. (Why do you need an activity at all here?)

You need to call StartActivity to start the activity in this case.

When I try to query the database from the service the app crashes.

This service thing is driveng me nuts
 
Upvote 0
Top