-
-
Save wackyapps/f55497071dd4275f3ab4e77cd1b60219 to your computer and use it in GitHub Desktop.
Appcelerator Titanium Android Background Service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// start service | |
var SECONDS = 20; // every 10 seconds | |
var intent = Titanium.Android.createServiceIntent({ | |
url: 'logservice.js' | |
}); | |
intent.putExtra('interval', SECONDS * 1000); // Needs to be milliseconds | |
Titanium.Android.startService(intent); | |
// stop service | |
var intent = Titanium.Android.createServiceIntent({ | |
url: 'logservice.js' | |
}); | |
Titanium.Android.stopService(intent); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// for Alloy this file goes in /assets | |
Ti.API.info('write something'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<android xmlns:android="http://schemas.android.com/apk/res/android"> | |
<services> | |
<service url="logservice.js" type="interval"/> | |
</services> | |
</android> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment