Jump to content

Recommended Posts

Hi,

I am looking for Delphi examples on waking up an application when an Android device is in sleep mode.
Setting an alarm with the AlarmManager

TAndroidHelper.AlarmManager.&set(TJAlarmManager.JavaClass.RTC_WAKEUP,...)

fires MyAppEvent on time, it writes a message in the Memo, but the app does NOT wake up.

function TfrMain.MyAppEvent(aAppEvent: TApplicationEvent;
  AContext: TObject): Boolean;
begin
  result := False;

  case aAppEvent of
    TApplicationEvent.BecameActive:
       memo1.Lines.Add('BecameActive');
 ...


 
Only when I manually wake up the device, I see the app appear on screen.

How can wake up the device when MyAppEvent notifies the event of becoming active? Even more, the app should become on the front of other running applications in the case the device is not asleep.

I've searched already on the possibilities of the AlarmManager and the PowerManager, but found nothing to wake up while being asleep.

Any example would be appreciated!
 

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×