Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. index.js
  2.  
  3.     var intent = Ti.Android.createServiceIntent({
  4.           url: 'alarmservice.js',
  5.                   action: Ti.Android.ACTION_MAIN,
  6.                   flags: Ti.Android.FLAG_ACTIVITY_NEW_TASK | Ti.Android.FLAG_ACTIVITY_SINGLE_TOP | Ti.Android.FLAG_ACTIVITY_CLEAR_TOP
  7. });
  8.  
  9. intent.addCategory(Ti.Android.CATEGORY_LAUNCHER);
  10. intent.putExtra('interval', 1000);
  11.  
  12. service = Titanium.Android.createService(intent);
  13. service.start();
  14.  
  15. ------------------------------------------------------------------------------------------------------------------------
  16.  
  17. alarmservice.js
  18.  
  19.     var service = Titanium.Android.currentService;
  20.     var intent = service.intent;
  21.  
  22.     Ti.Android.currentActivity.startActivity(intent);
  23.  
  24. ------------------------------------------------------------------------------------------------------------------------
  25.  
  26. tiapp.xml
  27.  
  28.     <activity android:name=".MyAppActivity"
  29.     android:label="MyApp" android:theme="@style/Theme.Titanium"
  30.     android:configChanges="keyboardHidden|orientation">
  31.         <intent-filter>
  32.             <action android:name="android.intent.action.MAIN" />
  33.             <category android:name="android.intent.category.LAUNCHER" />
  34.         </intent-filter>
  35.     </activity>
  36.     <services>
  37.         <service type="interval" url="alarmservice.js"/>
  38.     </services>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement