Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/myflashlab/alarmManager-ANE
What do you do if you need to run a task on a specific time even if your AdobeAir app is fully closed? you need an Alarm Manager air native extension!
https://github.com/myflashlab/alarmManager-ANE
Last synced: 2 months ago
JSON representation
What do you do if you need to run a task on a specific time even if your AdobeAir app is fully closed? you need an Alarm Manager air native extension!
- Host: GitHub
- URL: https://github.com/myflashlab/alarmManager-ANE
- Owner: myflashlab
- Archived: true
- Created: 2015-05-06T12:58:30.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2017-07-29T15:33:33.000Z (over 7 years ago)
- Last Synced: 2024-08-04T05:03:20.130Z (6 months ago)
- Language: ActionScript
- Homepage:
- Size: 16.3 MB
- Stars: 5
- Watchers: 4
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog.txt
Awesome Lists containing this project
- awesome-actionscript-sorted - alarmManager-ANE - What do you do if you need to run a task on a specific time even if your AIR app is fully closed? you need an Alarm Manager ANE (Native Extension / System ANE)
README
**NOTICE: This ANE is no longer managed. Instead you can use the [Scheduled Local Notification ANE](https://github.com/myflashlab/LocalNotification-ANE). We are leaving this repository as it is only for your reference.**
# Alarm Manager ANE V1.9.1 for Android
Alarm manager ANE is a very simple to use extension library which lets you set a time using the Date API in AS3 and setup a task to be executed as soon as the alarm goes off! this alarm manager extension is configured wisely enough so that even if the user reboots his/her device, the extension will be notified and will make sure that the task will run as expected!# asdoc
[find the latest asdoc for this ANE here.](http://myflashlab.github.io/asdoc/com/myflashlab/air/extensions/timerTask/package-detail.html)# Demo .apk
you may like to see the ANE in action? [Download demo .apk](https://github.com/myflashlab/alarmManager-ANE/tree/master/FD/dist)**NOTICE**: the demo ANE works only after you hit the "OK" button in the dialog which opens. in your tests make sure that you are NOT calling other ANE methods prior to hitting the "OK" button.
[Download the ANE](https://github.com/myflashlab/alarmManager-ANE/tree/master/FD/lib)# Air Usage
```actionscript
import com.myflashlab.air.extensions.timerTask.Alarm
import com.myflashlab.air.extensions.timerTask.AlarmEvent;
import com.myflashlab.air.extensions.timerTask.alarmTypes.Alarm_Notification;
import com.myflashlab.air.extensions.timerTask.alarmTypes.Alarm_ShowToast;
import com.myflashlab.air.extensions.timerTask.alarmTypes.Alarm_SimpleDispatch;
import com.myflashlab.air.extensions.timerTask.alarmTypes.alarm_Notification.TouchActionObject;// setup touch action objects
var actionObj1:TouchActionObject = new TouchActionObject();
actionObj1.setSelfType(); // every notification can have only one action with its "selfType" and upto 3 "BtnType" actions. Older Android versions does not support "BtnType" actions at all but you don't have to worry about this. your app won't break on older devices :)
actionObj1.setAppAction("Message to be sent to flash app when user touches the notification!");var actionObj2:TouchActionObject = new TouchActionObject();
actionObj2.setBtnType(0x0108001f, "myappsnippet"); //
actionObj2.setBrowseAction("http://www.myappsnippet.com/");var actionObj3:TouchActionObject = new TouchActionObject();
actionObj3.setBrowseAction("http://www.myflashlabs.com/");
actionObj3.setBtnType(0x0108001a, "myflashlabs");var actionObj4:TouchActionObject = new TouchActionObject();
actionObj4.setBrowseAction("http://www.google.com/");
actionObj4.setBtnType(0x0108001a, "google");// setup your task
var alarmTask:Alarm_Notification = new Alarm_Notification();
alarmTask.setWakeUp(true); // if true, then as soon as the alarm goes off, your device screen will turn on!
alarmTask.setDelay(5); // use delay based on seconds OR set a date with new "Date()"
alarmTask.setNotificationID(5); // you may use the id of this notification so you can manually remove it from your app
alarmTask.setContentTitle("title test");
alarmTask.setContentInfo("info test");
alarmTask.setContentNumber(0); // if this number is greater than 0, then "setContentText" won't be shown
alarmTask.setContentText("text test");
alarmTask.setLargeIconRes(0x01080029); // to use large icons from assets OR sdcard, you must send 0 for setLargeIconRes param
//alarmTask.setLargeIconAssets("notificationIcons/icon_512.png"); // to use large icons from sdcard pass an empty string "" for setLargeIconAssets
//alarmTask.setLargeIconSDcard(File.documentsDirectory.resolvePath("icon_512.png"));
alarmTask.setLights("#ff0000", 1, 1); // lights will be red and will blink every 1 seconds! (nothing will happen on a device with no lights hardware of course!)
alarmTask.setOngoing(false);
alarmTask.setOnlyAlertOnce(false);
alarmTask.setSmallIcon(0); // when set to 0, the app icon will be used or pass android default icons like 0x1080072
alarmTask.setSound(""); // an empty string will play device's default sound. to play your own mp3 file from sdcard, send File.documentsDirectory.resolvePath("sound01.mp3")
alarmTask.setSubText("sub text test");
alarmTask.setTicker("ticker test");
alarmTask.setTouchAction(actionObj1, actionObj2, actionObj3, actionObj4);
alarmTask.setVibrate(true);
alarmTask.setAutoCancel(true);// to use android default icons, find their constent values here:
// http://developer.android.com/reference/android/R.drawable.html// initialize the alarm and set its task
var _ex:Alarm = new Alarm();
var id:int = _ex.setAlarm(alarmTask.data);// you can cancel an alarm by its id
//_ex.cancelAlarm(id);
```# Air .xml manifest
```xml
```
# Requirements
* Android SDK 10 or higher# Commercial Version
http://www.myflashlabs.com/product/alarm-manager-ane-adobe-air-native-extension/![Alarm Manager ANE](http://www.myflashlabs.com/wp-content/uploads/2015/11/product_adobe-air-ane-alarm-manager-595x738.jpg)
# Tech Details
with the current first release of this extension we are supporting Android only but we are working on the iOS version too and we will update the extension as soon as it's ready but it's worthy to mention that you cannot be much creative with the iOS version of this extension! the reason is simple, it's because iOS has limited dev access to background processes. you may learn more about this on [apple here] (https://developer.apple.com/library/ios/documentation/iPhone/Reference/UILocalNotification_Class/). So, with the coming soon iOS version of this extension we will support UILocalNotification which sends local notifications to iOS based on a defined date and time. That's the best you can do with iOS when it comes to Alarm Management!# Tutorials
[How to embed ANEs into **FlashBuilder**, **FlashCC** and **FlashDevelop**](https://www.youtube.com/watch?v=Oubsb_3F3ec&list=PL_mmSjScdnxnSDTMYb1iDX4LemhIJrt1O)# Changelog
*Dec 20, 2015 - V1.9.1*
* minor bug fixes*Nov 03, 2015 - V1.9*
* doitflash devs merged into MyFLashLab Team*May 06, 2015 - V1.0*
* beginning of the journey!