App Inventor and Java


How to start an App Inventor app after a predefined time using the Activity Starter calling a Java app

Available for App Inventor 2!

The Android Alarm Manager provides access to the system alarm services. These allow you to schedule your application to be run at some point in the future. Well, unfortunately from within App Inventor we do not have access to the Alarm Manager...

Therefore I prepared the Java app Alarm Manager, which can start your app after a predefined time.

How does it work?

Your App Inventor app uses the activity starter component to tell the Alarm Manager, in how many minutes it should start the predefined app. As the Alarm Manager is designed, you can only set one alarm, but you can overwrite a previous alarm.


You can also cancel the alarm. Just send the parameter CANCEL to the Alarm Manager.

You have to enter the package name of the app to be started in the Alarm Manager.


New New in Version 1.2:
In case you forget to do this or you entered a wrong package name, later if the Alarm Manager tries to start your app, you will get an error message like this:

Logcat:

Permissions

Do you need help with your App Inventor project?

I can help you: for one hour I charge 25 USD.
Please contact me at info [at] puravidaapps [dot] com for details!
For questions about App Inventor, please use the App Inventor forum. Thank you.

Other possibilities

Note

The app to be triggered will be opened also while you are in a game or in a phone call, this might be something you do not like.

Example App Inventor project: Alarm Manager Test

The example App Inventor app Alarm Manager Test can be used together with the Alarm Manager to start a car alarm sound after x minutes. Thank you freesfx.co.uk for the car alarm sound.

Note: The example App Inventor app Alarm Manager Test works only, if the app Alarm Manager is installed on your device.

Screenshots

App Inventor Blocks

Download Alarm Manager Test

Download Alarm Manager Test aia file for App Inventor
Download Alarm Manager Test apk file

Download Alarm Manager

You can buy Alarm Manager for 3€ at Google Play.

Special version of the Alarm Manager

I'm also offering a special version of the Alarm Manager app, which can start exclusively your app. This version does not have a user interface, the package name of your app is stored inside the app and can't be modified. A user could download your app and additionally your special version of the Alarm Manager app from Google Play for free. In case you are interested, just transfer 25 USD via Paypal and send me the package name of your app. I then will prepare a special version including an App Inventor test project for you. You will be responsible to upload the special version to Google Play then.

Questions and Answers

Q1: Is it possible for you to package your Alarm Manager as an App Inventor Extension that I can include in my project?
A: Unfortunately this is not possible. App Inventor extensions have the same limitations as App Inventor itself, which means, they can't run in the background. You only can use the Alarm Manager app together with the activity starter.

Q2: If you do a "custom" Alarm Manager which exclusively calls my app, is it possible to automatically install that Alarm Manager when users install my app? In other words, can my app install a custom version of the Alarm Manager directly?
A: If you want to provide the special Alarm Manager version for the users to download from your Google Drive, see also How to download and install another app using the Activity Starter, anyone installing your app will need to change the setting on their phone to also allow installation of non-market applications.

You also can provide the special Alarm Manager version in Google Play. Your users will have to install it manually, but your app can send them to the page of your app in Google Play, see here How to launch Google Play from within your app.

Back to top of page ...

Creative Commons License
This work by Pura Vida Apps is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
with attribution (name=Pura Vida Apps and link to the source site) required.


Home | Snippets | Tutorials | Extensions | News | Forums | Links | Search | Contact