Awake phone from standby

thewavemaster

Member
Licensed User
Longtime User
I have a service modul running in the background that calls from time to time the sub of an activity. if the phone is not in standby mode everything is fine and works...but if its in standby mode nothing happens....

is there something special i have to do? is there a command to awake the phone from standby mode?
 

thewavemaster

Member
Licensed User
Longtime User
nd i dont want to use phonewakestate....to avoid standby mode all the time


i have something to add:

the code lines that include the service modul are working and doing their job...but the activity is not called!
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
nd i dont want to use phonewakestate....to avoid standby mode all the time
You can acquire a lock and later release it when it is not needed anymore.

CallSubDelayed will not show the activity if there are no visible activities. Instead the call will be queued until the activity resumes.

Why do you need to call an activity sub? Must this code be in the activity?
 
Upvote 0

thewavemaster

Member
Licensed User
Longtime User
its an alarm clock that plays a sound with the mediaplayer.
I dont know how else i should solve it? Playing the alarm with the service module is no problem, but stop playing it...
 
Upvote 0

thewavemaster

Member
Licensed User
Longtime User
so my dream would be:


When the alarm occurs (set/called by callserviceat).
an activity is loaded (no matter if standby or not / if the app is started or not).
this activity plays the alarm sound until the user press the Stop Playing Alarm button


no ideas?
 
Upvote 0

thedesolatesoul

Expert
Licensed User
Longtime User
so my dream would be:


When the alarm occurs (set/called by callserviceat).
an activity is loaded (no matter if standby or not / if the app is started or not).
this activity plays the alarm sound until the user press the Stop Playing Alarm button


no ideas?
Play the sound in the service. Then run StartActivity.
When the user cancels the alarm on the activity, do a CallSubDelayed in the service to stop the sound.
 
Upvote 0
Top