Skip to content

A sample project which demonstrates wrapping of "Android Terminal" code efficiently using RxJava2

Notifications You must be signed in to change notification settings

prathameshsawant9/RxTerminal

Repository files navigation

RxTerminal (Sample + Library)

A sample project which demonstrates wrapping of "Android Terminal" code efficiently using RxJava2. This project does not cover all aspects of accessing a Android Terminal. This is just a starter project which demonstrates how easy it is to manage work with RxJava2.

Example : command to execute "ping -c 4 www.google.com"

In above case the output is thrown every one sec, for which if it had been implemented with Asyntask, it would require a CallBack Interface that is attached to caller Class as well as AsyncTask Class, making the code much complicated. But with RxJava2, the intermediate response of the command can be emitted using "FlowableEmitter emitter" of Flowable.

and the final result would look like

RxTerminal.execute("ping -c 4 www.google.com")
          .observeOn(AndroidSchedulers.mainThread())
          .subscribeOn(Schedulers.io())
          .subscribe( this::printValue,
                      this::printError,
                      this::printCompleted));

MIT License

Copyright (c) 2017 Prathamesh Sawant.

About

A sample project which demonstrates wrapping of "Android Terminal" code efficiently using RxJava2

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages