Jump to content

Search the Community

Showing results for tags 'alarmmanager'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Delphi Questions and Answers
    • Algorithms, Data Structures and Class Design
    • VCL
    • FMX
    • RTL and Delphi Object Pascal
    • Databases
    • Network, Cloud and Web
    • Windows API
    • Cross-platform
    • Delphi IDE and APIs
    • General Help
    • Delphi Third-Party
  • C++Builder Questions and Answers
    • General Help
  • General Discussions
    • Embarcadero Lounge
    • Tips / Blogs / Tutorials / Videos
    • Job Opportunities / Coder for Hire
    • I made this
  • Software Development
    • Project Planning and -Management
    • Software Testing and Quality Assurance
  • Community
    • Community Management

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Delphi-Version

Found 2 results

  1. I need to open application periodically every minute. For testing I have a simple application with just this code that should open the application: function getTimeAfterInSecs(Seconds: Integer): Int64; var Calendar: JCalendar; begin Calendar := TJCalendar.JavaClass.getInstance; Calendar.add(TJCalendar.JavaClass.SECOND, Seconds); Result := Calendar.getTimeInMillis; end; procedure TForm2.Button1Click(Sender: TObject); var Intent: JIntent; PendingIntent: JPendingIntent; LFlags: Integer; begin Intent := TJIntent.Create; Intent.setClassName(TAndroidHelper.Context, StringToJString('com.embarcadero.firemonkey.FMXNativeActivity')); LFlags := TJPendingIntent.JavaClass.FLAG_UPDATE_CURRENT or TJPendingIntent.JavaClass.FLAG_IMMUTABLE; PendingIntent := TJPendingIntent.JavaClass.getActivity(TAndroidHelper.Context, 1, Intent, LFlags); TAndroidHelper.AlarmManager.&set(TJAlarmManager.JavaClass.RTC_WAKEUP, getTimeAfterInSecs(60), PendingIntent); end; procedure TForm2.Button2Click(Sender: TObject); var Intent: JIntent; PendingIntent: JPendingIntent; LFlags: Integer; AlarmManager: JAlarmManager; begin Intent := TJIntent.Create; Intent.setClassName(TAndroidHelper.Context, StringToJString('com.embarcadero.firemonkey.FMXNativeActivity')); LFlags := TJPendingIntent.JavaClass.FLAG_UPDATE_CURRENT or TJPendingIntent.JavaClass.FLAG_IMMUTABLE; PendingIntent := TJPendingIntent.JavaClass.getActivity(TAndroidHelper.Context, 0, Intent, LFlags); AlarmManager := TJAlarmManager.Wrap(TAndroidHelper.Context.getSystemService(TJContext.JavaClass.ALARM_SERVICE)); AlarmManager.setExactAndAllowWhileIdle(TJAlarmManager.JavaClass.RTC_WAKEUP, getTimeAfterInSecs(60), PendingIntent); end; Unfortunately the application does not open. What am I doing wrong?
  2. Haai5

    Wake up!

    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!
×