Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Stutern Graduate Accelerator 0.7 Android develo...

Stutern Graduate Accelerator 0.7 Android development guest session - Introduction to Multithreading and Networking on Android

In this presentation, I introduced two programming concepts to beginner Android developers in the Stutern Graduate Accelerator 0.7 Android development track. I explored Multithreading and Networking on Android with RxJava and Retrofit.

I also shared some career advice based on my experience. It touched on topics such as figuring out what employers are looking out for, learning how to build a career portfolio as an Android developer and how to find job opportunities.

Moyinoluwa Adeyemi

February 18, 2020
Tweet

More Decks by Moyinoluwa Adeyemi

Other Decks in Programming

Transcript

  1. A/F S Activity/Fragment (A/F) Service (S) Content Providers (CP) Broadcast

    Receivers (BR) BR CP A/F Message Queue Android Components
  2. A/F S BR CP A/F } 10ms } 13ms }

    16ms } 15ms } 4ms 60fps
  3. A/F S BR CP A/F } 10ms } 13ms }

    16ms } 20ms } 4ms Jank
  4. RxJava “RxJava is a Java VM implementation of ReactiveX a

    library for composing asynchronous and event-based programs by using observable sequences.”
  5. RxJava - Schedulers “Executes arbitrary blocks of code, possibly in

    the future” Schedulers + subscribeOn() + observeOn()
  6. Schedulers.io() • Unbounded pool of threads • Threads are recycled

    • Used for I/O bound tasks • Tasks take some time to complete
  7. Schedulers.computation() • Bounded pool of threads • Used for CPU

    intensive tasks • Computation threads limited to the number of CPU cores
  8. subscribeOn() • Determines the thread which the source observable emits

    on • Works upstream - only the first call counts
  9. subscribeOn() What thread will the source observable emit on? Observable.just("Hello",

    "World") .subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.computation()) ...
  10. observeOn() • Switches the current observable to the specified thread

    • Works downstream - only the last call counts
  11. observeOn() What thread will the current observable be emitted on?

    Observable.just("Hello", "World") .subscribeOn(Schedulers.io()) .observeOn(Schedulers.computation()) .observeOn(AndroidSchedulers.mainThread()) ...
  12. TestScheduler “A special, non thread-safe scheduler for testing operators that

    require a scheduler without introducing real concurrency and allows manually advancing a virtual time.”
  13. Retrofit • Open source library for making HTTP requests •

    Accepts an HTTP client • Accepts a Call Adapter factory
  14. Retrofit • Open source library for making HTTP requests •

    Accepts an HTTP client • Accepts a Call Adapter factory • Accepts a Converter factory
  15. Retrofit - Converters • Gson: com.squareup.retrofit2:converter-gson • Jackson: com.squareup.retrofit2:converter-jackson •

    Moshi: com.squareup.retrofit2:converter-moshi • Protobuf: com.squareup.retrofit2:converter-protobuf • Wire: com.squareup.retrofit2:converter-wire • Simple XML: com.squareup.retrofit2:converter-simplexml • Scalars (primitives, boxed, and String): com.squareup.retrofit2:converter-scalars
  16. Retrofit - Interface https://demo.sga.org/latest?town=lagos interface DemoService { @GET("/latest") fun getLatestDemo(@Query("town")

    town: String): Observable<Demo> } val demoService = retrofit.create(DemoService::class.java)
  17. Import Retrofit in Gradle // moshi implementation "com.squareup.moshi:moshi-kotlin:$moshi_version" implementation "com.squareup.moshi:moshi-adapters:$moshi_version"

    // Retrofit implementation "com.squareup.retrofit2:retrofit:$retrofit_version" implementation "com.squareup.retrofit2:converter-moshi:$moshi_converter_version" implementation "com.squareup.retrofit2:adapter-rxjava2:$rx_java_adapter_version"
  18. What are employers looking for? • Technical Experience suitable for

    the role • “Soft” skills • Growth potential
  19. What are employers looking for? • Technical Experience suitable for

    the role • “Soft” skills • Growth potential • Bonus - Writing skills
  20. What are employers looking for? • Technical Experience suitable for

    the role • “Soft” skills • Growth potential • Bonus - Writing skills • Bonus - Contributions to the community
  21. Building a career portfolio • Contribute to an existing project

    • Upload code snippets or sample apps to Github
  22. Building a career portfolio • Contribute to an existing project

    • Upload code snippets or sample apps to Github • Publish apps on Google Play
  23. Building a career portfolio • Contribute to an existing project

    • Upload code snippets or sample apps to Github • Publish apps on Google Play • Write technical articles
  24. Building a career portfolio • Contribute to an existing project

    • Upload code snippets or sample apps to Github • Publish apps on Google Play • Write technical articles • Give talks
  25. How to find opportunities • Social media (LinkedIn, Twitter, StackOverflow

    Jobs) • Newsletters (Forloop, Android/Kotlin Weekly)
  26. How to find opportunities • Social media (LinkedIn, Twitter, StackOverflow

    Jobs) • Newsletters (Forloop, Android/Kotlin Weekly) • Job Search marketplace (Hired.com, Fiverr, Upwork)
  27. How to find opportunities • Social media (LinkedIn, Twitter, StackOverflow

    Jobs) • Newsletters (Forloop, Android/Kotlin Weekly) • Job Search marketplace (Hired.com, Fiverr, Upwork) • Company Career pages
  28. How to find opportunities • Social media (LinkedIn, Twitter, StackOverflow

    Jobs) • Newsletters (Forloop, Android/Kotlin Weekly) • Job Search marketplace (Hired.com, Fiverr, Upwork) • Company Career pages • Employee referrals
  29. Take home task Create a one page app with GitHub’s

    public REST API, listing all names of users in Lagos. The app should make use of both RxJava and Retrofit for networking. Make the network request on the io thread. For bonus points, use an Android App architecture and write tests.