SHARE
TWEET

Untitled

a guest Oct 12th, 2017 49 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public class I3 extends Service {
  2.  
  3.     @Override
  4.     public IBinder onBind(Intent intent) {
  5.         return null;
  6.     }
  7.  
  8.     @Override
  9.     public void onCreate() {
  10.         super.onCreate();
  11.     }
  12.  
  13.     @Override
  14.     public int onStartCommand(Intent intent, int flags, int startId) {
  15.         ...
  16.         return START_STICKY;
  17.     }
  18.  
  19.     @Override
  20.     public void onDestroy() {
  21.         super.onDestroy();
  22.         sendBroadcast(new Intent("com.mypackage.Restart"));
  23.     }
  24.     ...
  25. }
  26.    
  27. public class I2 extends BroadcastReceiver {
  28.  
  29.     @Override
  30.     public void onReceive(Context context, Intent intent) {
  31.         context.startService(new Intent(context, I3.class));
  32.     }
  33. }
  34.    
  35. ...
  36. <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
  37. ...
  38. <uses-sdk
  39.     android:minSdkVersion="15"
  40.     android:targetSdkVersion="25" />
  41. <application
  42.     android:allowBackup="true"
  43.     android:icon="@drawable/ic_launcher"
  44.     android:label="@string/app_name"
  45.     android:theme="@android:style/Theme.NoTitleBar" >
  46.     <activity
  47.         android:name=".I1"
  48.         android:label="@string/app_name"
  49.         android:theme="@android:style/Theme.NoTitleBar.Fullscreen" >
  50.         <intent-filter>
  51.             <action android:name="android.intent.action.MAIN" />
  52.             <category android:name="android.intent.category.LAUNCHER" />
  53.         </intent-filter>
  54.     </activity>
  55.     <receiver
  56.         android:name=".I2"
  57.         android:label="@string/app_name" >
  58.         <intent-filter>
  59.             <action android:name="android.intent.action.BOOT_COMPLETED" />
  60.         </intent-filter>
  61.         <intent-filter>
  62.             <action android:name="com.mypackage.Restart" />
  63.         </intent-filter>
  64.     </receiver>
  65.     <service
  66.         android:name=".I3"
  67.         android:label="@string/app_name" />
  68. </application>
  69. ...
RAW Paste Data
Top