Skip to content

Commit

Permalink
updated for booleans in PersistableBundle
Browse files Browse the repository at this point in the history
  • Loading branch information
commonsguy committed Apr 16, 2015
1 parent 086086b commit cc02b4c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions JobScheduler/PowerHungry/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ buildscript {
apply plugin: 'com.android.application'

dependencies {
compile 'com.android.support:support-v13:21.0.3'
compile 'com.android.support:support-v13:22.0.0'
}

android {
compileSdkVersion 21
buildToolsVersion "21.0.1"
compileSdkVersion 22
buildToolsVersion "22.0.1"

sourceSets {
main {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class DemoJobService extends JobService {
public boolean onStartJob(JobParameters params) {
PersistableBundle pb=params.getExtras();

if (pb.getInt(MainActivity.KEY_DOWNLOAD_AS_AN_INT, 0)==1) {
if (pb.getBoolean(MainActivity.KEY_DOWNLOAD, false)) {
job=new DownloadThread(params);
job.start();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class MainActivity extends Activity
AlarmManager.INTERVAL_HOUR
};
private static final int JOB_ID=1337;
static final String KEY_DOWNLOAD_AS_AN_INT="isDownload";
static final String KEY_DOWNLOAD="isDownload";
private Spinner type=null;
private Spinner period=null;
private Switch download=null;
Expand Down Expand Up @@ -133,7 +133,7 @@ private void manageJobScheduler(boolean start) {
PersistableBundle pb=new PersistableBundle();

if (download.isChecked()) {
pb.putInt(KEY_DOWNLOAD_AS_AN_INT, 1);
pb.putBoolean(KEY_DOWNLOAD, true);
b.setExtras(pb).setRequiredNetworkType(JobInfo.NETWORK_TYPE_ANY);
} else {
b.setRequiredNetworkType(JobInfo.NETWORK_TYPE_NONE);
Expand Down

0 comments on commit cc02b4c

Please sign in to comment.