Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- index.js
- var intent = Ti.Android.createServiceIntent({
- url: 'alarmservice.js',
- action: Ti.Android.ACTION_MAIN,
- flags: Ti.Android.FLAG_ACTIVITY_NEW_TASK | Ti.Android.FLAG_ACTIVITY_SINGLE_TOP | Ti.Android.FLAG_ACTIVITY_CLEAR_TOP
- });
- intent.addCategory(Ti.Android.CATEGORY_LAUNCHER);
- intent.putExtra('interval', 1000);
- service = Titanium.Android.createService(intent);
- service.start();
- ------------------------------------------------------------------------------------------------------------------------
- alarmservice.js
- var service = Titanium.Android.currentService;
- var intent = service.intent;
- Ti.Android.currentActivity.startActivity(intent);
- ------------------------------------------------------------------------------------------------------------------------
- tiapp.xml
- <activity android:name=".MyAppActivity"
- android:label="MyApp" android:theme="@style/Theme.Titanium"
- android:configChanges="keyboardHidden|orientation">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- <services>
- <service type="interval" url="alarmservice.js"/>
- </services>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement