Is background monitoring of sensors possible?

mistermentality

Active Member
Licensed User
Longtime User
Okay, I have the right forum this time so here goes....

I see you can make services that run in the background, I wonder is it possible to check the sensors that detect movement while running in the background?

Specifically I want to be able to write an app that will run in the background and if no movement has been detected for say an hour or two to send an sms alerting someone of this. But I'm not so sure this is possible with Basic4Android?

Dave
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Specifically I want to be able to write an app that will run in the background and if no movement has been detected for say an hour or two to send an sms alerting someone of this. But I'm not so sure this is possible with Basic4Android?
This is possible. All you need to do is start a service and listen for sensor events in this service.
You should call Service.StartForeground to make sure that the OS doesn't kill your application.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…