Android 10 , WakeUP

  

got here an App with Messaging support. And while I can download the Messages in the Background , the Vibration does not work if the Screen is off.
So I tried this :
procedure TMain.doVibration(milisec: Integer);
var Vibrator : JVibrator;
PowerManager : JPowerManager;
begin
PowerManager := TJPowerManager.Wrap(TAndroidHelper.Context.getSystemService(TJContext.JavaClass.POWER_SERVICE));

if PowerManager.isInteractive = false then PowerManager.wakeUp(1000);

Vibrator := TJVibrator.Wrap((SharedActivityContext.getSystemService(TJContext.JavaClass.VIBRATOR_SERVICE) as ILocalObject).GetObjectID);
Vibrator.vibrate(milisec);
end;

Unfortunately this does not work, most of the time it simply locks up my app . Sometimes I get a permission error . In Delphi I set the permission for WAKE_LOCK to true.
I would just like to vibrate even if the Screen is Off , is this possible?
Thank you.

Comments are closed.