Skip to content

Instantly share code, notes, and snippets.

@amitshekhariitbhu
Created July 1, 2018 16:18
Show Gist options
  • Save amitshekhariitbhu/28ea31bd295330c5111d7a48e7353d78 to your computer and use it in GitHub Desktop.
Save amitshekhariitbhu/28ea31bd295330c5111d7a48e7353d78 to your computer and use it in GitHub Desktop.

Using RxPS - RxJavaPriorityScheduler Library in your Android application

Add this in your build.gradle

implementation 'com.mindorks.scheduler:rxps:0.1.0'

Setting low level priority for a task - use RxPS.low()

getObservable()
.subscribeOn(RxPS.low())
.subscribe(getObserver());

// or

getObservable()
.subscribeOn(RxPS.get(Priority.LOW))
.subscribe(getObserver());

Setting medium level priority for a task - use RxPS.medium()

getObservable()
.subscribeOn(RxPS.medium())
.subscribe(getObserver());

// or

getObservable()
.subscribeOn(RxPS.get(Priority.MEDIUM))
.subscribe(getObserver());

Setting high level priority for a task - use RxPS.high()

getObservable()
.subscribeOn(RxPS.high())
.subscribe(getObserver());

// or

getObservable()
.subscribeOn(RxPS.get(Priority.HIGH))
.subscribe(getObserver());

Setting immediate level priority for a task - use RxPS.immediate()

getObservable()
.subscribeOn(RxPS.immediate())
.subscribe(getObserver());

// or

getObservable()
.subscribeOn(RxPS.get(Priority.IMMEDIATE))
.subscribe(getObserver());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment