You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 25, 2019. It is now read-only.
Good night.
When I ran the program in KITKAT the program did not go into Loop, run the code only once, but shows no error, just stopped, follows the JobService class, thanks:
public class JobSchedulerService extends JobService {
public static final String TAG = "LOG";
@Override
public boolean onStartJob(JobParameters params) {
Log.i(TAG, "onStartJob("+params.getExtras().getString("string")+")");
new MyAsyncTask(this).execute(params);
return true;
}
@Override
public boolean onStopJob(JobParameters params) {
Log.i(TAG, "onStopJob()");
return true;
}
// INNER CLASS
private static class MyAsyncTask extends AsyncTask<JobParameters, Void, String>{
private JobSchedulerService jss;
public MyAsyncTask(JobSchedulerService j){
jss = j;
}
@Override
protected String doInBackground(JobParameters... params) {
Log.i(TAG, "doInBackground()");
SystemClock.sleep(5000);
String answer = HttpConnection
.getSetDataWeb("http://www.villopim.com.br/android/ExampleJobScheduler/get-random.php",
"method");
jss.jobFinished(params[0], true);
return answer;
}
@Override
protected void onPostExecute(String s) {
Log.i(TAG, "onPostExecute()");
EventBus.getDefault().post( new MessageEB( s ));
}
}