CopyPastor

Detecting plagiarism made easy.

Score: 1.8530870552699104; Reported for: String similarity, Exact paragraph match Open both answers

Possible Plagiarism

Plagiarized on 2019-03-15
by Ashwin Khadgi

Original Post

Original - Posted on 2018-04-15
by kosev



            
Present in both answers; Present only in the new answer; Present only in the old answer;


The best way is to use JobIntentService which uses the new JobScheduler for Oreo or the old services if not available.
Declare in your manifest:
<service android:name=".YourService" android:permission="android.permission.BIND_JOB_SERVICE"/>
And in your service you have to replace onHandleIntent with onHandleWork:
public class YourService extends JobIntentService { public static final int JOB_ID = 1; public static void enqueueWork(Context context, Intent work) { enqueueWork(context, YourService.class, JOB_ID, work); } @Override protected void onHandleWork(@NonNull Intent intent) { // your code } }
Then you start your service with:
YourService.enqueueWork(context, new Intent());
The best way is to use [JobIntentService][1] which uses the new JobScheduler for Oreo or the old services if not available.
Declare in your manifest:
<service android:name=".YourService" android:permission="android.permission.BIND_JOB_SERVICE"/>
And in your service you have to replace onHandleIntent with onHandleWork:
public class YourService extends JobIntentService { public static final int JOB_ID = 1; public static void enqueueWork(Context context, Intent work) { enqueueWork(context, YourService.class, JOB_ID, work); } @Override protected void onHandleWork(@NonNull Intent intent) { // your code } } Then you start your service with:
YourService.enqueueWork(context, new Intent());

[1]: https://developer.android.com/reference/android/support/v4/app/JobIntentService.html

        
Present in both answers; Present only in the new answer; Present only in the old answer;