SlideShare a Scribd company logo
1 of 14
Android Getting Started
The UPTech way
What’s on the list?
Basic Libraries
Dependency Injection with Dagger 2
RxAndroid
Custom Views FTW
The Future: Kotlin
Basic Libraries
Butterknife
Retrolambda
REST Trio: Retrofit, OkHttp, Gson
Image Loading: Glide, Fresco
Realm
Dependency Injection with Dagger 2
class ApiService {
public void uploadPhoto(String user, File file) {
OkHttpClient client = new OkHttpClient();
Gson gson = new Gson();
Request request = // TODO build a post request
client.newCall(request).execute();
}
}
Dependency Injection with Dagger 2
class ApiService {
Gson gson = new Gson();
OkHttpClient client = new OkHttpClient()
public void uploadPhoto(String user, File file) {
Request request = // TODO build a post request
client.newCall(request).execute();
}
}
Dependency Injection with Dagger 2
class ApiService {
Gson gson;
OkHttpClient client;
public ApiService(OkHttpClient client, Gson gson) {
this.client = client;
this.gson = gson;
}
public void uploadPhoto(String user, File file) {
Request request = // TODO build a post request
client.newCall(request).execute();
}
}
Dependency Injection with Dagger 2
OkHttpClient client = new OkHttpClient();
Gson gson = new Gson();
ApiService apiService = new ApiService(client, gson);
apiService.uploadPhoto("UPTechTeam", file);
Dependency Injection
OkHttpClient client = new OkHttpClient();
Gson gson = new Gson();
ApiService apiService = new ApiService(client, gson);
RealmConfiguration config = new RealmConfiguration.Builder(context)
.deleteRealmIfMigrationNeeded()
.build();
Realm.setDefaultConfiguration(config);
Realm realm = Realm.getDefaultInstance();
Preferences preferences = new Preferences(context);
AccountManager accountManager = new AccountManager(apiService, database, preferences);
accountManager.getUser();
Dependency Injection
@Inject
AccountManager accountManager;
@Override
protected void onCreate(final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Application.appComponent().inject(this);
accountManager.getUser()
}
Dependency Injection with Dagger 2
api.registerWithEmail(email, password, new Callback<RegisterResponse>() {
@Override
public void onResponse(Call<RegisterResponse> call, Response<RegisterResponse> response) {
if (response.isSuccess()) {
api.getUser(response.token, new Callback<User>() {
@Override
public void onResponse(Call<User> call, Response<User> response) {
if (response.isSuccess()) {}
database.saveUser()
} else {
showError(...);
}
}
@Override
public void onFailure(Call<User> call, Throwable t) {
showError(...);
}
});
} else {
if (ErrorResponse.isAlreadyRegistered(response.getErrorBody())) {
api.login(email, password, new Callback<LoginResponse>() {
@Override
public void onResponse(Call<LoginResponse> call, Response<LoginResponse> response) {
preferences.saveToken(response);
api.getUser(response.token, new Callback<User>() {
@Override
public void onResponse(Call<User> call, Response<User> response) {
RxAndroid
public Observable<UserInfo> registerAndLogin(String email, String password) {
return apiService.registerWithEmail(new RegisterRequest(email, password))
.flatMap(userInfo -> apiService.signInWithEmail(new SignInRequest(email, password)))
.doOnNext(signInResponse -> preferences.saveAccessToken(signInResponse.accessToken))
.onErrorResumeNext(e -> ErrorResponse.isAlreadyRegistered(e) ? apiService.signInWithEmail(new
SignInRequest(email, password)) : errorObservable(e))
.flatMap(ignore -> getUser())
.doOnNext(user -> database.saveUser(user));
}
RxAndroid
>> Improving UX with RX
RxAndroid
>> Thanks!
UPTech

More Related Content

What's hot

Event-Driven Systems With MongoDB
Event-Driven Systems With MongoDBEvent-Driven Systems With MongoDB
Event-Driven Systems With MongoDBAndrii Litvinov
 
End to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux SagaEnd to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux SagaBabacar NIANG
 
Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017
Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017
Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017Mike Nakhimovich
 
Hidden-Web Induced by Client-Side Scripting: An Empirical Study
Hidden-Web Induced by Client-Side Scripting: An Empirical StudyHidden-Web Induced by Client-Side Scripting: An Empirical Study
Hidden-Web Induced by Client-Side Scripting: An Empirical StudySALT Lab @ UBC
 
MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...
MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...
MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...MongoDB
 
Apache Incubator Samza: Stream Processing at LinkedIn
Apache Incubator Samza: Stream Processing at LinkedInApache Incubator Samza: Stream Processing at LinkedIn
Apache Incubator Samza: Stream Processing at LinkedInChris Riccomini
 
iOS Keychain by 흰, 민디
iOS Keychain by 흰, 민디iOS Keychain by 흰, 민디
iOS Keychain by 흰, 민디MINJICHO20
 
Understanding JavaScript Event-based Interactions
Understanding JavaScript Event-based InteractionsUnderstanding JavaScript Event-based Interactions
Understanding JavaScript Event-based InteractionsSALT Lab @ UBC
 
Parceable serializable
Parceable serializableParceable serializable
Parceable serializableSourabh Sahu
 
Integration solution with daxtra resume indexing
Integration solution with daxtra resume indexingIntegration solution with daxtra resume indexing
Integration solution with daxtra resume indexingAndy Yang
 
API Days Paris - Automatic Testing of (RESTful) API Documentation
API Days Paris - Automatic Testing of (RESTful) API DocumentationAPI Days Paris - Automatic Testing of (RESTful) API Documentation
API Days Paris - Automatic Testing of (RESTful) API DocumentationRouven Weßling
 
Automation in angular js
Automation in angular jsAutomation in angular js
Automation in angular jsMarcin Wosinek
 
Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...
Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...
Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...Red Hat Developers
 
MongoDB.local Sydney: How and When to Use Multi-Document Distributed Transact...
MongoDB.local Sydney: How and When to Use Multi-Document Distributed Transact...MongoDB.local Sydney: How and When to Use Multi-Document Distributed Transact...
MongoDB.local Sydney: How and When to Use Multi-Document Distributed Transact...MongoDB
 
Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1
Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1
Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1Toshiaki Maki
 
Integrando sistemas via OData (caso de estudiio GeneXus-SAP)
Integrando sistemas via OData (caso de estudiio GeneXus-SAP)Integrando sistemas via OData (caso de estudiio GeneXus-SAP)
Integrando sistemas via OData (caso de estudiio GeneXus-SAP)GeneXus
 

What's hot (20)

Event-Driven Systems With MongoDB
Event-Driven Systems With MongoDBEvent-Driven Systems With MongoDB
Event-Driven Systems With MongoDB
 
End to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux SagaEnd to end todo list app with NestJs - Angular - Redux & Redux Saga
End to end todo list app with NestJs - Angular - Redux & Redux Saga
 
Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017
Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017
Data Loading Made Easy with Mike Nakhimovich DroidCon Italy 2017
 
Hidden-Web Induced by Client-Side Scripting: An Empirical Study
Hidden-Web Induced by Client-Side Scripting: An Empirical StudyHidden-Web Induced by Client-Side Scripting: An Empirical Study
Hidden-Web Induced by Client-Side Scripting: An Empirical Study
 
RxSubject And Operators
RxSubject And OperatorsRxSubject And Operators
RxSubject And Operators
 
MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...
MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...
MongoDB.local DC 2018: Ch-Ch-Ch-Ch-Changes: Taking Your MongoDB Stitch Applic...
 
Apache Incubator Samza: Stream Processing at LinkedIn
Apache Incubator Samza: Stream Processing at LinkedInApache Incubator Samza: Stream Processing at LinkedIn
Apache Incubator Samza: Stream Processing at LinkedIn
 
iOS Keychain by 흰, 민디
iOS Keychain by 흰, 민디iOS Keychain by 흰, 민디
iOS Keychain by 흰, 민디
 
Understanding JavaScript Event-based Interactions
Understanding JavaScript Event-based InteractionsUnderstanding JavaScript Event-based Interactions
Understanding JavaScript Event-based Interactions
 
Retro vs volley (2)
Retro vs volley (2)Retro vs volley (2)
Retro vs volley (2)
 
Parceable serializable
Parceable serializableParceable serializable
Parceable serializable
 
Integration solution with daxtra resume indexing
Integration solution with daxtra resume indexingIntegration solution with daxtra resume indexing
Integration solution with daxtra resume indexing
 
API Days Paris - Automatic Testing of (RESTful) API Documentation
API Days Paris - Automatic Testing of (RESTful) API DocumentationAPI Days Paris - Automatic Testing of (RESTful) API Documentation
API Days Paris - Automatic Testing of (RESTful) API Documentation
 
Automation in angular js
Automation in angular jsAutomation in angular js
Automation in angular js
 
05 binding and action
05 binding and action05 binding and action
05 binding and action
 
Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...
Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...
Jupyter Notebooks for machine learning on Kubernetes & OpenShift | DevNation ...
 
MongoDB.local Sydney: How and When to Use Multi-Document Distributed Transact...
MongoDB.local Sydney: How and When to Use Multi-Document Distributed Transact...MongoDB.local Sydney: How and When to Use Multi-Document Distributed Transact...
MongoDB.local Sydney: How and When to Use Multi-Document Distributed Transact...
 
Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1
Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1
Spring Boot Actuator 2.0 & Micrometer #jjug_ccc #ccc_a1
 
ASP.NET WEB API
ASP.NET WEB APIASP.NET WEB API
ASP.NET WEB API
 
Integrando sistemas via OData (caso de estudiio GeneXus-SAP)
Integrando sistemas via OData (caso de estudiio GeneXus-SAP)Integrando sistemas via OData (caso de estudiio GeneXus-SAP)
Integrando sistemas via OData (caso de estudiio GeneXus-SAP)
 

Viewers also liked

Generics. PECS
Generics. PECSGenerics. PECS
Generics. PECSUptech
 
Tuberculosis Pulmonar
Tuberculosis PulmonarTuberculosis Pulmonar
Tuberculosis PulmonarFAMEN
 
Beer Bottle Night Lamp
Beer Bottle Night LampBeer Bottle Night Lamp
Beer Bottle Night LampOmer Kilic
 
Clean architecture on Android
Clean architecture on AndroidClean architecture on Android
Clean architecture on AndroidGDG Odessa
 

Viewers also liked (6)

Generics. PECS
Generics. PECSGenerics. PECS
Generics. PECS
 
4919_for_Ikoma
4919_for_Ikoma4919_for_Ikoma
4919_for_Ikoma
 
Tuberculosis Pulmonar
Tuberculosis PulmonarTuberculosis Pulmonar
Tuberculosis Pulmonar
 
COLOMBIA NUESTRA TIERRA
COLOMBIA NUESTRA TIERRACOLOMBIA NUESTRA TIERRA
COLOMBIA NUESTRA TIERRA
 
Beer Bottle Night Lamp
Beer Bottle Night LampBeer Bottle Night Lamp
Beer Bottle Night Lamp
 
Clean architecture on Android
Clean architecture on AndroidClean architecture on Android
Clean architecture on Android
 

Similar to Android getting started

可抽換元件設計模式
可抽換元件設計模式可抽換元件設計模式
可抽換元件設計模式Pete Chen
 
Dagger 2 - Injeção de Dependência
Dagger 2 - Injeção de DependênciaDagger 2 - Injeção de Dependência
Dagger 2 - Injeção de DependênciaEdson Menegatti
 
API 통신, Retrofit 대신 Ktor 어떠신가요.pdf
API 통신, Retrofit 대신 Ktor 어떠신가요.pdfAPI 통신, Retrofit 대신 Ktor 어떠신가요.pdf
API 통신, Retrofit 대신 Ktor 어떠신가요.pdfssuserb6c2641
 
Sharper Better Faster Dagger ‡ - Droidcon SF
Sharper Better Faster Dagger ‡ - Droidcon SFSharper Better Faster Dagger ‡ - Droidcon SF
Sharper Better Faster Dagger ‡ - Droidcon SFPierre-Yves Ricau
 
Nestjs MasterClass Slides
Nestjs MasterClass SlidesNestjs MasterClass Slides
Nestjs MasterClass SlidesNir Kaufman
 
Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02rhemsolutions
 
Jug Guice Presentation
Jug Guice PresentationJug Guice Presentation
Jug Guice PresentationDmitry Buzdin
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android InfrastructureAlexey Buzdin
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android InfrastructureC.T.Co
 
Rapid development tools for java ee 8 [tut2998]
Rapid development tools for java ee 8 [tut2998]Rapid development tools for java ee 8 [tut2998]
Rapid development tools for java ee 8 [tut2998]Payara
 
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGeneBang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGeneDroidConTLV
 
Rapid Development Tools for Java EE 8 [TUT2998]
Rapid Development Tools for Java EE 8 [TUT2998]Rapid Development Tools for Java EE 8 [TUT2998]
Rapid Development Tools for Java EE 8 [TUT2998]Gaurav Gupta
 
Android Bootstrap
Android BootstrapAndroid Bootstrap
Android Bootstrapdonnfelker
 
Modern Android app library stack
Modern Android app library stackModern Android app library stack
Modern Android app library stackTomáš Kypta
 
Spca2014 hillier build your_own_rest_service
Spca2014 hillier build your_own_rest_serviceSpca2014 hillier build your_own_rest_service
Spca2014 hillier build your_own_rest_serviceNCCOMMS
 
Retrofit 2 - O que devemos saber
Retrofit 2 - O que devemos saberRetrofit 2 - O que devemos saber
Retrofit 2 - O que devemos saberBruno Vieira
 
The lazy programmers guide to consuming web services
The lazy programmers guide to consuming web services The lazy programmers guide to consuming web services
The lazy programmers guide to consuming web services mamnun
 

Similar to Android getting started (20)

可抽換元件設計模式
可抽換元件設計模式可抽換元件設計模式
可抽換元件設計模式
 
Dagger 2 - Injeção de Dependência
Dagger 2 - Injeção de DependênciaDagger 2 - Injeção de Dependência
Dagger 2 - Injeção de Dependência
 
API 통신, Retrofit 대신 Ktor 어떠신가요.pdf
API 통신, Retrofit 대신 Ktor 어떠신가요.pdfAPI 통신, Retrofit 대신 Ktor 어떠신가요.pdf
API 통신, Retrofit 대신 Ktor 어떠신가요.pdf
 
Sharper Better Faster Dagger ‡ - Droidcon SF
Sharper Better Faster Dagger ‡ - Droidcon SFSharper Better Faster Dagger ‡ - Droidcon SF
Sharper Better Faster Dagger ‡ - Droidcon SF
 
Nestjs MasterClass Slides
Nestjs MasterClass SlidesNestjs MasterClass Slides
Nestjs MasterClass Slides
 
Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02Architecting your GWT applications with GWT-Platform - Lesson 02
Architecting your GWT applications with GWT-Platform - Lesson 02
 
Jug Guice Presentation
Jug Guice PresentationJug Guice Presentation
Jug Guice Presentation
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
 
Overview of Android Infrastructure
Overview of Android InfrastructureOverview of Android Infrastructure
Overview of Android Infrastructure
 
Rapid development tools for java ee 8 [tut2998]
Rapid development tools for java ee 8 [tut2998]Rapid development tools for java ee 8 [tut2998]
Rapid development tools for java ee 8 [tut2998]
 
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGeneBang-Bang, you have been hacked - Yonatan Levin, KolGene
Bang-Bang, you have been hacked - Yonatan Levin, KolGene
 
Rapid Development Tools for Java EE 8 [TUT2998]
Rapid Development Tools for Java EE 8 [TUT2998]Rapid Development Tools for Java EE 8 [TUT2998]
Rapid Development Tools for Java EE 8 [TUT2998]
 
Android Bootstrap
Android BootstrapAndroid Bootstrap
Android Bootstrap
 
Modern Android app library stack
Modern Android app library stackModern Android app library stack
Modern Android app library stack
 
Codemotion appengine
Codemotion appengineCodemotion appengine
Codemotion appengine
 
Android workshop
Android workshopAndroid workshop
Android workshop
 
Spca2014 hillier build your_own_rest_service
Spca2014 hillier build your_own_rest_serviceSpca2014 hillier build your_own_rest_service
Spca2014 hillier build your_own_rest_service
 
Android development
Android developmentAndroid development
Android development
 
Retrofit 2 - O que devemos saber
Retrofit 2 - O que devemos saberRetrofit 2 - O que devemos saber
Retrofit 2 - O que devemos saber
 
The lazy programmers guide to consuming web services
The lazy programmers guide to consuming web services The lazy programmers guide to consuming web services
The lazy programmers guide to consuming web services
 

More from Uptech

Android studio 2.2 Tips and Tricks
Android studio 2.2 Tips and TricksAndroid studio 2.2 Tips and Tricks
Android studio 2.2 Tips and TricksUptech
 
Scrum. A brief introduction
Scrum. A brief introductionScrum. A brief introduction
Scrum. A brief introductionUptech
 
App coordinators in iOS
App coordinators in iOSApp coordinators in iOS
App coordinators in iOSUptech
 
Ruby language overview
Ruby language overviewRuby language overview
Ruby language overviewUptech
 
Getting things done intro
Getting things done introGetting things done intro
Getting things done introUptech
 
Mvp tech talks
Mvp tech talksMvp tech talks
Mvp tech talksUptech
 

More from Uptech (6)

Android studio 2.2 Tips and Tricks
Android studio 2.2 Tips and TricksAndroid studio 2.2 Tips and Tricks
Android studio 2.2 Tips and Tricks
 
Scrum. A brief introduction
Scrum. A brief introductionScrum. A brief introduction
Scrum. A brief introduction
 
App coordinators in iOS
App coordinators in iOSApp coordinators in iOS
App coordinators in iOS
 
Ruby language overview
Ruby language overviewRuby language overview
Ruby language overview
 
Getting things done intro
Getting things done introGetting things done intro
Getting things done intro
 
Mvp tech talks
Mvp tech talksMvp tech talks
Mvp tech talks
 

Recently uploaded

Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineeringssuserb3a23b
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odishasmiwainfosol
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Cizo Technology Services
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
cpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptcpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptrcbcrtm
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Andreas Granig
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsSafe Software
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 

Recently uploaded (20)

Software Coding for software engineering
Software Coding for software engineeringSoftware Coding for software engineering
Software Coding for software engineering
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company OdishaBalasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
Balasore Best It Company|| Top 10 IT Company || Balasore Software company Odisha
 
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
Global Identity Enrolment and Verification Pro Solution - Cizo Technology Ser...
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva2.pdf Ejercicios de programación competitiva
2.pdf Ejercicios de programación competitiva
 
cpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.pptcpct NetworkING BASICS AND NETWORK TOOL.ppt
cpct NetworkING BASICS AND NETWORK TOOL.ppt
 
Odoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting ServiceOdoo Development Company in India | Devintelle Consulting Service
Odoo Development Company in India | Devintelle Consulting Service
 
Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024Automate your Kamailio Test Calls - Kamailio World 2024
Automate your Kamailio Test Calls - Kamailio World 2024
 
Advantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your BusinessAdvantages of Odoo ERP 17 for Your Business
Advantages of Odoo ERP 17 for Your Business
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Powering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data StreamsPowering Real-Time Decisions with Continuous Data Streams
Powering Real-Time Decisions with Continuous Data Streams
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 

Android getting started

  • 2. What’s on the list? Basic Libraries Dependency Injection with Dagger 2 RxAndroid Custom Views FTW The Future: Kotlin
  • 3. Basic Libraries Butterknife Retrolambda REST Trio: Retrofit, OkHttp, Gson Image Loading: Glide, Fresco Realm
  • 4. Dependency Injection with Dagger 2 class ApiService { public void uploadPhoto(String user, File file) { OkHttpClient client = new OkHttpClient(); Gson gson = new Gson(); Request request = // TODO build a post request client.newCall(request).execute(); } }
  • 5. Dependency Injection with Dagger 2 class ApiService { Gson gson = new Gson(); OkHttpClient client = new OkHttpClient() public void uploadPhoto(String user, File file) { Request request = // TODO build a post request client.newCall(request).execute(); } }
  • 6. Dependency Injection with Dagger 2 class ApiService { Gson gson; OkHttpClient client; public ApiService(OkHttpClient client, Gson gson) { this.client = client; this.gson = gson; } public void uploadPhoto(String user, File file) { Request request = // TODO build a post request client.newCall(request).execute(); } }
  • 7. Dependency Injection with Dagger 2 OkHttpClient client = new OkHttpClient(); Gson gson = new Gson(); ApiService apiService = new ApiService(client, gson); apiService.uploadPhoto("UPTechTeam", file);
  • 9. OkHttpClient client = new OkHttpClient(); Gson gson = new Gson(); ApiService apiService = new ApiService(client, gson); RealmConfiguration config = new RealmConfiguration.Builder(context) .deleteRealmIfMigrationNeeded() .build(); Realm.setDefaultConfiguration(config); Realm realm = Realm.getDefaultInstance(); Preferences preferences = new Preferences(context); AccountManager accountManager = new AccountManager(apiService, database, preferences); accountManager.getUser(); Dependency Injection
  • 10. @Inject AccountManager accountManager; @Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); Application.appComponent().inject(this); accountManager.getUser() } Dependency Injection with Dagger 2
  • 11. api.registerWithEmail(email, password, new Callback<RegisterResponse>() { @Override public void onResponse(Call<RegisterResponse> call, Response<RegisterResponse> response) { if (response.isSuccess()) { api.getUser(response.token, new Callback<User>() { @Override public void onResponse(Call<User> call, Response<User> response) { if (response.isSuccess()) {} database.saveUser() } else { showError(...); } } @Override public void onFailure(Call<User> call, Throwable t) { showError(...); } }); } else { if (ErrorResponse.isAlreadyRegistered(response.getErrorBody())) { api.login(email, password, new Callback<LoginResponse>() { @Override public void onResponse(Call<LoginResponse> call, Response<LoginResponse> response) { preferences.saveToken(response); api.getUser(response.token, new Callback<User>() { @Override public void onResponse(Call<User> call, Response<User> response) { RxAndroid
  • 12. public Observable<UserInfo> registerAndLogin(String email, String password) { return apiService.registerWithEmail(new RegisterRequest(email, password)) .flatMap(userInfo -> apiService.signInWithEmail(new SignInRequest(email, password))) .doOnNext(signInResponse -> preferences.saveAccessToken(signInResponse.accessToken)) .onErrorResumeNext(e -> ErrorResponse.isAlreadyRegistered(e) ? apiService.signInWithEmail(new SignInRequest(email, password)) : errorObservable(e)) .flatMap(ignore -> getUser()) .doOnNext(user -> database.saveUser(user)); } RxAndroid
  • 13. >> Improving UX with RX RxAndroid