SlideShare una empresa de Scribd logo
1 de 49
and its Implementation in Android
+sidiqpermana
@nouvrizky10
A passionate developer who
loves coding, teaching,
travelling and diving so much.
Cofounder & CIO Nusantara Beta Studio
Intel Software Innovator
Google Developer Expert
Introduction to Firebase
Firebase is a mobile platform that helps you
quickly develop high-quality apps, grow your
user base, and earn more money. Firebase is
made up of complementary features that you
can mix-and-match to fit your needs.
Firebase has shifted from the Backend as a Service to Unified App Platform
Forget about the backend and
infrastructure complexity Easy to Track the app
Analytics and Free forever
Run on
Your beloved languages!
Makes your life app development easier
Let’s Talk About Firebase
Code
What We’ll gonna do
Sync data using the Firebase Realtime Database.
Receive background messages with Firebase Notifications.
Configure an application with Firebase Remote Config.
Track application usage flows with Firebase Analytics.
Allow users to send invitations to install with Firebase Invites.
Report crashes with Firebase Crash Reporting.
Test your app with Firebase Test Lab.
You could also try the CodeLab : https://codelabs.developers.google.com/codelabs/firebase-
https://goo.gl/ioU9FB
Go to the links to see how the app works.
First of All : Create a Hello World New Project
Go to :
https://console.firebase.google.com/
Your Friendly Firebase Dashboard
Add Firebase
to your project
C:Program FilesJavajdk1.8.0_40bin>keytool.exe -exportcert -alias androiddebu
gkey -keystore "C:/debug.keystore" -list -v -storepass android
Alias name: androiddebugkey
Creation date: 05 Apr 15
Entry type: PrivateKeyEntry
Certificate chain length: 1
Certificate[1]:
Owner: CN=Android Debug, O=Android, C=US
Issuer: CN=Android Debug, O=Android, C=US
Serial number: 1832afe8
Valid from: Sun Apr 05 23:19:45 ICT 2015 until: Tue Mar 28 23:19:45 ICT 2045
Certificate fingerprints:
MD5: CC:A1:BC:33:63:E0:BB:70:24:D2:C4:42:44:16:D1:C5
SHA1: BE:19:F6:EE:74:9F:0D:80:42:56:ED:A6:01:8B:1F:60:ED:F0:F4:24
SHA256: D6:86:58:8F:4B:57:DB:6A:57:6F:0C:1E:70:26:7F:C8:A6:C2:92:EF:7D:
72:E1:25:55:81:40:D6:EE:CE:0E:83
Signature algorithm name: SHA256withRSA
Version: 3
Now you app is already exist in Firebase
Console. We have just integrated it.
Next? Run the sample code!
Grab the code on :
$ git clone https://github.com/firebase/friendlychat
Then Import the Android-Start Project to your beloved Android Studio
Voila! The Friendly Chat
is already installed in
Android device. Next?
We are going to set up
the Authentication.
Authenticate user
{
"rules": {
".read": "auth != null",
".write": "auth != null"
}
}
Get the details : https://firebase.google.com/docs/database/security/quickstart
compile 'com.google.firebase:firebase-auth:9.0.0'
mFirebaseAuth = FirebaseAuth.getInstance();
mFirebaseUser = mFirebaseAuth.getCurrentUser();
if (mFirebaseUser == null) {
// Not signed in, launch the Sign In activity
startActivity(new Intent(this, SignInActivity.class));
finish();
return;
} else {
mUsername = mFirebaseUser.getDisplayName();
if (mFirebaseUser.getPhotoUrl() != null) {
mPhotoUrl = mFirebaseUser.getPhotoUrl().toString();
}
}
Sign In with GoogleSignInApi
Intent signInIntent =
Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, RC_SIGN_IN);
SignIn Callback
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
// Result returned from launching the Intent from
GoogleSignInApi.getSignInIntent(...);
if (requestCode == RC_SIGN_IN) {
GoogleSignInResult result =
Auth.GoogleSignInApi.getSignInResultFromIntent(data);
if (result.isSuccess()) {
// Google Sign In was successful, authenticate with Firebase
GoogleSignInAccount account = result.getSignInAccount();
firebaseAuthWithGoogle(account);
} else {
// Google Sign In failed
Log.e(TAG, "Google Sign In failed.");
}
}
}
Firebase processing the credential
private void firebaseAuthWithGoogle(GoogleSignInAccount acct) {
Log.d(TAG, "firebaseAuthWithGooogle:" + acct.getId());
AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(),
null);
mFirebaseAuth.signInWithCredential(credential)
.addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
@Override
public void onComplete(@NonNull Task<AuthResult> task) {
Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful());
if (!task.isSuccessful()) {
Log.w(TAG, "signInWithCredential", task.getException());
Toast.makeText(SignInActivity.this, "Authentication failed.",
Toast.LENGTH_SHORT).show();
} else {
startActivity(new Intent(SignInActivity.this, MainActivity.class));
finish();
}
}});
}
After Adding few lines of code for Authentication
purpose. Now we can see that the app has functional
Sign In page. Next we set up the real time database.
Firebase Realtime Database
compile 'com.google.firebase:firebase-database:9.0.0'
mFirebaseDatabaseReference =
FirebaseDatabase.getInstance().getReference();
That will access the database https://friendlychat-
c8cfb.firebaseio.com/
How do we send the message?
FriendlyMessage friendlyMessage = new
FriendlyMessage(mMessageEditText.getText().toString(),
mUsername,
mPhotoUrl);
mFirebaseDatabaseReference.child(MESSAGES_CHILD)
.push().setValue(friendlyMessage);
Firebase Realtime Database will synch your
app message. Next? Add the Firebase Cloud
Messaging to the app.
Receive the notification
compile 'com.google.firebase:firebase-messaging:9.0.0'
Create two service class inherit to :
FirebaseMessagingService and FirebaseInstanceIdService
Like the other chat app. The notification is
a mandatory functionality. With Firebase
you could do that easily by using Firebase
Cloud Messaging that push your message
Through GCM.
The awesome one : Firebase Remote Config
Feature
Firebase Remote Config gives you instantly-updatable variables that you can use
to tune and customize your app on the fly to deliver the best experience to your
users. You can enable or disable features or change the look and feel without
having to publish a new version. You can also target configurations to specific
Firebase Analytics Audiences so that each of your users has an experience that’s
tailored for them.
Next ? We implement App Invite to Invite more users to use our app.
Show me the code
Put the dependency : compile 'com.google.firebase:firebase-config:9.0.0'
// Initialize Firebase Remote Config.
mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance();
// Define Firebase Remote Config Settings.
FirebaseRemoteConfigSettings firebaseRemoteConfigSettings =
new FirebaseRemoteConfigSettings.Builder()
.setDeveloperModeEnabled(true)
.build();
// Define default config values. Defaults are used when fetched config values are not
// available. Eg: if an error occurred fetching values from the server.
Map<String, Object> defaultConfigMap = new HashMap<>();
defaultConfigMap.put("friendly_msg_length", 10L);
// Apply config settings and default values.
mFirebaseRemoteConfig.setConfigSettings(firebaseRemoteConfigSettings);
mFirebaseRemoteConfig.setDefaults(defaultConfigMap);
// Fetch remote config.
fetchConfig();
public void fetchConfig() {
long cacheExpiration = 3600;
if (mFirebaseRemoteConfig.getInfo().getConfigSettings()
.isDeveloperModeEnabled()) {
cacheExpiration = 0;
}
mFirebaseRemoteConfig.fetch(cacheExpiration)
.addOnSuccessListener(new OnSuccessListener<Void>() {
@Override
public void onSuccess(Void aVoid) {
mFirebaseRemoteConfig.activateFetched();
applyRetrievedLengthLimit();
}
})
.addOnFailureListener(new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
Log.w(TAG, "Error fetching config: " +
e.getMessage());
applyRetrievedLengthLimit();
}
});
}
private void applyRetrievedLengthLimit() {
Long friendly_msg_length =
mFirebaseRemoteConfig.getLong("friendly_msg_length");
mMessageEditText.setFilters(new InputFilter[]{new
InputFilter.LengthFilter(friendly_msg_length.intValue())});
Log.d(TAG, "FML is: " + friendly_msg_length);
}
We apply the changes in that method
Firebase App Invite
Easy to invite our friends to use our
app.Next? We Implement the analytics.
Dependency :
compile'com.google.android.gms:play-services-appinvite:9.0.0'
//Create the instance of GoogleApiClient
mGoogleApiClient = new GoogleApiClient.Builder(this)
.addApi(AppInvite.API)
.enableAutoManage(this, this)
.build();
Send the Invitation through the Intent
Intent intent = new
AppInviteInvitation.IntentBuilder(getString(R.string.invitation_title))
.setMessage(getString(R.string.invitation_message))
.setCallToActionText(getString(R.string.invitation_cta))
.build();
startActivityForResult(intent, REQUEST_INVITE);
The callback
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Log.d(TAG, "onActivityResult: requestCode=" + requestCode +
", resultCode=" + resultCode);
if (requestCode == REQUEST_INVITE) {
if (resultCode == RESULT_OK) {
// Check how many invitations were sent.
String[] ids = AppInviteInvitation
.getInvitationIds(resultCode, data);
Log.d(TAG, "Invitations sent: " + ids.length);
} else {
// Sending failed or it was canceled, show failure message to
// the user
Log.d(TAG, "Failed to send invitation.");
}
}
}
Implement the Firebase Analytics
Similar to Google Analytics ? YES OF COURSE!
Drop the dependency to lovely gradle
compile 'com.google.firebase:firebase-analytics:9.0.0'
Create an Instance
mFirebaseAnalytics =
FirebaseAnalytics.getInstance(this);
Send the event
Bundle payload = new Bundle();
payload.putString(FirebaseAnalytics.Param.VALUE, "sent");
mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SHARE,
payload);
Implement Firebase Report Crashes (beta)
Just the dependency :
compile 'com.google.firebase:firebase-crash:9.0.0'
Test App in The Cloud
Firebase Test Lab lets you test your app on various types of Android devices
across multiple API levels and locales. The best part is that all this testing
happens automatically in the cloud without you needing to maintain a collection of
test devices.
Unfortunately this is the Freemium Feature :D.
You should upgrade your package to Blaze.
Hasil Log TestLab
Firebase Dynamic Links
Firebase Dynamic Links are smart URLs that dynamically change behavior to provide the best experience across
different platforms.
Dynamic Links can link to different content depending on the platform they're opened on. In addition, Dynamic Links
work across app installs: if a user opens a Dynamic Link and doesn't have your app installed, the user can be prompted
to install it; then, after installation, your app starts and can access the link.
It works with App Invite.
Dependency :
compile 'com.google.firebase:firebase-invites:9.0.2'
How does it look like?
Conclusion
The new Firebase platform will make your life app development becomes easier.
It contains a bunch of Tools, easy to use and well documented although several of
them still need enhancement.
These are useful resources:
https://firebase.google.com/docs/
https://codelabs.developers.google.com/codelabs/firebase-android
https://www.udacity.com/course/firebase-essentials-for-android--ud009
And Give a try to Firebase :)
Thanks

Más contenido relacionado

La actualidad más candente

The Play Framework at LinkedIn
The Play Framework at LinkedInThe Play Framework at LinkedIn
The Play Framework at LinkedInYevgeniy Brikman
 
Communication in Node.js
Communication in Node.jsCommunication in Node.js
Communication in Node.jsEdureka!
 
Building Applications With the MEAN Stack
Building Applications With the MEAN StackBuilding Applications With the MEAN Stack
Building Applications With the MEAN StackNir Noy
 
Cool JVM Tools to Help You Test
Cool JVM Tools to Help You TestCool JVM Tools to Help You Test
Cool JVM Tools to Help You TestSchalk Cronjé
 
The world of gradle - an introduction for developers
The world of gradle  - an introduction for developersThe world of gradle  - an introduction for developers
The world of gradle - an introduction for developersTricode (part of Dept)
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Rajmahendra Hegde
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation ToolIzzet Mustafaiev
 
Dropwizard and Friends
Dropwizard and FriendsDropwizard and Friends
Dropwizard and FriendsYun Zhi Lin
 
The Past Year in Spring for Apache Geode
The Past Year in Spring for Apache GeodeThe Past Year in Spring for Apache Geode
The Past Year in Spring for Apache GeodeVMware Tanzu
 
Advanced Dagger talk from 360andev
Advanced Dagger talk from 360andevAdvanced Dagger talk from 360andev
Advanced Dagger talk from 360andevMike Nakhimovich
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Enginecatherinewall
 
Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Matt Raible
 

La actualidad más candente (20)

The Play Framework at LinkedIn
The Play Framework at LinkedInThe Play Framework at LinkedIn
The Play Framework at LinkedIn
 
Communication in Node.js
Communication in Node.jsCommunication in Node.js
Communication in Node.js
 
Angular beans
Angular beansAngular beans
Angular beans
 
Building Applications With the MEAN Stack
Building Applications With the MEAN StackBuilding Applications With the MEAN Stack
Building Applications With the MEAN Stack
 
Cool JVM Tools to Help You Test
Cool JVM Tools to Help You TestCool JVM Tools to Help You Test
Cool JVM Tools to Help You Test
 
Spring Boot
Spring BootSpring Boot
Spring Boot
 
The world of gradle - an introduction for developers
The world of gradle  - an introduction for developersThe world of gradle  - an introduction for developers
The world of gradle - an introduction for developers
 
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012Gradle build tool that rocks with DSL JavaOne India 4th May 2012
Gradle build tool that rocks with DSL JavaOne India 4th May 2012
 
From JavaEE to AngularJS
From JavaEE to AngularJSFrom JavaEE to AngularJS
From JavaEE to AngularJS
 
Gradle - the Enterprise Automation Tool
Gradle  - the Enterprise Automation ToolGradle  - the Enterprise Automation Tool
Gradle - the Enterprise Automation Tool
 
Dropwizard and Friends
Dropwizard and FriendsDropwizard and Friends
Dropwizard and Friends
 
Agility Requires Safety
Agility Requires SafetyAgility Requires Safety
Agility Requires Safety
 
The Past Year in Spring for Apache Geode
The Past Year in Spring for Apache GeodeThe Past Year in Spring for Apache Geode
The Past Year in Spring for Apache Geode
 
Apache DeltaSpike the CDI toolbox
Apache DeltaSpike the CDI toolboxApache DeltaSpike the CDI toolbox
Apache DeltaSpike the CDI toolbox
 
Advanced Dagger talk from 360andev
Advanced Dagger talk from 360andevAdvanced Dagger talk from 360andev
Advanced Dagger talk from 360andev
 
Introduction to Spring Boot
Introduction to Spring BootIntroduction to Spring Boot
Introduction to Spring Boot
 
Gradle Introduction
Gradle IntroductionGradle Introduction
Gradle Introduction
 
Dust.js
Dust.jsDust.js
Dust.js
 
Cannibalising The Google App Engine
Cannibalising The  Google  App  EngineCannibalising The  Google  App  Engine
Cannibalising The Google App Engine
 
Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021Java REST API Framework Comparison - UberConf 2021
Java REST API Framework Comparison - UberConf 2021
 

Destacado

I/O Extended (GDG Bogor) - Narenda Wicaksono
I/O Extended (GDG Bogor) - Narenda WicaksonoI/O Extended (GDG Bogor) - Narenda Wicaksono
I/O Extended (GDG Bogor) - Narenda WicaksonoDicoding
 
I/O Extended (GDG Bogor) - Andrew Kurniadi
I/O Extended (GDG Bogor) - Andrew KurniadiI/O Extended (GDG Bogor) - Andrew Kurniadi
I/O Extended (GDG Bogor) - Andrew KurniadiDicoding
 
ID Android TechTalk Series #6 : Google Service and Gradle - Andrew Kurniadi
ID Android TechTalk Series #6 : Google Service and Gradle - Andrew KurniadiID Android TechTalk Series #6 : Google Service and Gradle - Andrew Kurniadi
ID Android TechTalk Series #6 : Google Service and Gradle - Andrew KurniadiDicoding
 
Talkshow - Android N & I/O Update
Talkshow - Android N & I/O UpdateTalkshow - Android N & I/O Update
Talkshow - Android N & I/O UpdateDicoding
 
ID Android TechTalk Series #6 : Google Service and Gradle - Ibnu Sina Wardy
ID Android TechTalk Series #6 : Google Service and Gradle - Ibnu Sina WardyID Android TechTalk Series #6 : Google Service and Gradle - Ibnu Sina Wardy
ID Android TechTalk Series #6 : Google Service and Gradle - Ibnu Sina WardyDicoding
 
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...Dicoding
 
Continuous Integration & Continuous Delivery on Android - Nur Rendra Toro Sin...
Continuous Integration & Continuous Delivery on Android - Nur Rendra Toro Sin...Continuous Integration & Continuous Delivery on Android - Nur Rendra Toro Sin...
Continuous Integration & Continuous Delivery on Android - Nur Rendra Toro Sin...Dicoding
 

Destacado (7)

I/O Extended (GDG Bogor) - Narenda Wicaksono
I/O Extended (GDG Bogor) - Narenda WicaksonoI/O Extended (GDG Bogor) - Narenda Wicaksono
I/O Extended (GDG Bogor) - Narenda Wicaksono
 
I/O Extended (GDG Bogor) - Andrew Kurniadi
I/O Extended (GDG Bogor) - Andrew KurniadiI/O Extended (GDG Bogor) - Andrew Kurniadi
I/O Extended (GDG Bogor) - Andrew Kurniadi
 
ID Android TechTalk Series #6 : Google Service and Gradle - Andrew Kurniadi
ID Android TechTalk Series #6 : Google Service and Gradle - Andrew KurniadiID Android TechTalk Series #6 : Google Service and Gradle - Andrew Kurniadi
ID Android TechTalk Series #6 : Google Service and Gradle - Andrew Kurniadi
 
Talkshow - Android N & I/O Update
Talkshow - Android N & I/O UpdateTalkshow - Android N & I/O Update
Talkshow - Android N & I/O Update
 
ID Android TechTalk Series #6 : Google Service and Gradle - Ibnu Sina Wardy
ID Android TechTalk Series #6 : Google Service and Gradle - Ibnu Sina WardyID Android TechTalk Series #6 : Google Service and Gradle - Ibnu Sina Wardy
ID Android TechTalk Series #6 : Google Service and Gradle - Ibnu Sina Wardy
 
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
ID Android TechTalk Series #6 : Google Service and Gradle - Anton Nurdin Tuha...
 
Continuous Integration & Continuous Delivery on Android - Nur Rendra Toro Sin...
Continuous Integration & Continuous Delivery on Android - Nur Rendra Toro Sin...Continuous Integration & Continuous Delivery on Android - Nur Rendra Toro Sin...
Continuous Integration & Continuous Delivery on Android - Nur Rendra Toro Sin...
 

Similar a Firebase Implementation in Android: Introduction to Firebase Features

Firebase integration with Flutter
Firebase integration with FlutterFirebase integration with Flutter
Firebase integration with Flutterpmgdscunsri
 
ThreeBase: Firebase in 3 minutes or less
ThreeBase: Firebase in 3 minutes or lessThreeBase: Firebase in 3 minutes or less
ThreeBase: Firebase in 3 minutes or lessMayank Mohan Upadhyay
 
Firebase in a Nutshell
Firebase in a NutshellFirebase in a Nutshell
Firebase in a NutshellSumit Sahoo
 
What is new in Firebase?
What is new in Firebase?What is new in Firebase?
What is new in Firebase?Sinan Yılmaz
 
Using Java to interact with Firebase in Android
Using Java to interact with Firebase in AndroidUsing Java to interact with Firebase in Android
Using Java to interact with Firebase in AndroidMagda Miu
 
iOSDevCamp Firebase Overview
iOSDevCamp Firebase OverviewiOSDevCamp Firebase Overview
iOSDevCamp Firebase OverviewJames Daniels
 
Lecture 11 Firebase overview
Lecture 11 Firebase overviewLecture 11 Firebase overview
Lecture 11 Firebase overviewMaksym Davydov
 
Firebase - A real-time server
Firebase - A real-time serverFirebase - A real-time server
Firebase - A real-time serverAneeq Anwar
 
Deploy Firebase Backend as a Service Model for Application Development
Deploy Firebase Backend as a Service Model for Application DevelopmentDeploy Firebase Backend as a Service Model for Application Development
Deploy Firebase Backend as a Service Model for Application DevelopmentDashTechnologiesInc
 
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...MongoDB
 
Building with Firebase
Building with FirebaseBuilding with Firebase
Building with FirebaseMike Fowler
 
Tk2323 lecture 8 firebase
Tk2323 lecture 8   firebaseTk2323 lecture 8   firebase
Tk2323 lecture 8 firebaseMengChun Lam
 

Similar a Firebase Implementation in Android: Introduction to Firebase Features (20)

Apresentação firebase
Apresentação firebaseApresentação firebase
Apresentação firebase
 
Firebase
FirebaseFirebase
Firebase
 
Firebase integration with Flutter
Firebase integration with FlutterFirebase integration with Flutter
Firebase integration with Flutter
 
ThreeBase: Firebase in 3 minutes or less
ThreeBase: Firebase in 3 minutes or lessThreeBase: Firebase in 3 minutes or less
ThreeBase: Firebase in 3 minutes or less
 
Firebase in a Nutshell
Firebase in a NutshellFirebase in a Nutshell
Firebase in a Nutshell
 
Cloud Messaging Flutter
Cloud Messaging FlutterCloud Messaging Flutter
Cloud Messaging Flutter
 
What is new in Firebase?
What is new in Firebase?What is new in Firebase?
What is new in Firebase?
 
Firebase Tech Talk By Atlogys
Firebase Tech Talk By AtlogysFirebase Tech Talk By Atlogys
Firebase Tech Talk By Atlogys
 
Using Java to interact with Firebase in Android
Using Java to interact with Firebase in AndroidUsing Java to interact with Firebase in Android
Using Java to interact with Firebase in Android
 
Firebase
Firebase Firebase
Firebase
 
iOSDevCamp Firebase Overview
iOSDevCamp Firebase OverviewiOSDevCamp Firebase Overview
iOSDevCamp Firebase Overview
 
Lecture 11 Firebase overview
Lecture 11 Firebase overviewLecture 11 Firebase overview
Lecture 11 Firebase overview
 
Firebase overview
Firebase overviewFirebase overview
Firebase overview
 
19-03-22.pdf
19-03-22.pdf19-03-22.pdf
19-03-22.pdf
 
Firebase - A real-time server
Firebase - A real-time serverFirebase - A real-time server
Firebase - A real-time server
 
Deploy Firebase Backend as a Service Model for Application Development
Deploy Firebase Backend as a Service Model for Application DevelopmentDeploy Firebase Backend as a Service Model for Application Development
Deploy Firebase Backend as a Service Model for Application Development
 
LiveOps para games usando o Firebase
LiveOps para games usando o FirebaseLiveOps para games usando o Firebase
LiveOps para games usando o Firebase
 
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
MongoDB World 2018: Tutorial - Got Dibs? Building a Real-Time Bidding App wit...
 
Building with Firebase
Building with FirebaseBuilding with Firebase
Building with Firebase
 
Tk2323 lecture 8 firebase
Tk2323 lecture 8   firebaseTk2323 lecture 8   firebase
Tk2323 lecture 8 firebase
 

Más de Dicoding

Produktif dalam Membangun Game - Adam Ardisasmita (Arsakids)
Produktif dalam Membangun Game - Adam Ardisasmita (Arsakids)Produktif dalam Membangun Game - Adam Ardisasmita (Arsakids)
Produktif dalam Membangun Game - Adam Ardisasmita (Arsakids)Dicoding
 
Mencari Genre Game yang Sesuai Passion - Cipto Adiguno (Ekuator Games)
Mencari Genre Game yang Sesuai Passion - Cipto Adiguno (Ekuator Games)Mencari Genre Game yang Sesuai Passion - Cipto Adiguno (Ekuator Games)
Mencari Genre Game yang Sesuai Passion - Cipto Adiguno (Ekuator Games)Dicoding
 
Menjadi Tuan Rumah di Negeri Sendiri - Fauzil Hamdi (CEO The Wali)
Menjadi Tuan Rumah di Negeri Sendiri - Fauzil Hamdi (CEO The Wali)Menjadi Tuan Rumah di Negeri Sendiri - Fauzil Hamdi (CEO The Wali)
Menjadi Tuan Rumah di Negeri Sendiri - Fauzil Hamdi (CEO The Wali)Dicoding
 
ID Developer Elite
ID Developer EliteID Developer Elite
ID Developer EliteDicoding
 
Sidiq Permana - Building For The Next Billion Users
Sidiq Permana - Building For The Next Billion UsersSidiq Permana - Building For The Next Billion Users
Sidiq Permana - Building For The Next Billion UsersDicoding
 
Rendra Toro - Model View Presenter
Rendra Toro - Model View PresenterRendra Toro - Model View Presenter
Rendra Toro - Model View PresenterDicoding
 
Yoza Aprilio - We must design
Yoza Aprilio - We must designYoza Aprilio - We must design
Yoza Aprilio - We must designDicoding
 
Agus Hamonangan - Sejarah Android, Penetrasi/Pertumbungan, dan Peluang Smartp...
Agus Hamonangan - Sejarah Android, Penetrasi/Pertumbungan, dan Peluang Smartp...Agus Hamonangan - Sejarah Android, Penetrasi/Pertumbungan, dan Peluang Smartp...
Agus Hamonangan - Sejarah Android, Penetrasi/Pertumbungan, dan Peluang Smartp...Dicoding
 
ID Android Dev Talk - Observer Pattern, Event Bus Usage, Firebase & Geofire
ID Android Dev Talk  - Observer Pattern, Event Bus Usage, Firebase & GeofireID Android Dev Talk  - Observer Pattern, Event Bus Usage, Firebase & Geofire
ID Android Dev Talk - Observer Pattern, Event Bus Usage, Firebase & GeofireDicoding
 

Más de Dicoding (9)

Produktif dalam Membangun Game - Adam Ardisasmita (Arsakids)
Produktif dalam Membangun Game - Adam Ardisasmita (Arsakids)Produktif dalam Membangun Game - Adam Ardisasmita (Arsakids)
Produktif dalam Membangun Game - Adam Ardisasmita (Arsakids)
 
Mencari Genre Game yang Sesuai Passion - Cipto Adiguno (Ekuator Games)
Mencari Genre Game yang Sesuai Passion - Cipto Adiguno (Ekuator Games)Mencari Genre Game yang Sesuai Passion - Cipto Adiguno (Ekuator Games)
Mencari Genre Game yang Sesuai Passion - Cipto Adiguno (Ekuator Games)
 
Menjadi Tuan Rumah di Negeri Sendiri - Fauzil Hamdi (CEO The Wali)
Menjadi Tuan Rumah di Negeri Sendiri - Fauzil Hamdi (CEO The Wali)Menjadi Tuan Rumah di Negeri Sendiri - Fauzil Hamdi (CEO The Wali)
Menjadi Tuan Rumah di Negeri Sendiri - Fauzil Hamdi (CEO The Wali)
 
ID Developer Elite
ID Developer EliteID Developer Elite
ID Developer Elite
 
Sidiq Permana - Building For The Next Billion Users
Sidiq Permana - Building For The Next Billion UsersSidiq Permana - Building For The Next Billion Users
Sidiq Permana - Building For The Next Billion Users
 
Rendra Toro - Model View Presenter
Rendra Toro - Model View PresenterRendra Toro - Model View Presenter
Rendra Toro - Model View Presenter
 
Yoza Aprilio - We must design
Yoza Aprilio - We must designYoza Aprilio - We must design
Yoza Aprilio - We must design
 
Agus Hamonangan - Sejarah Android, Penetrasi/Pertumbungan, dan Peluang Smartp...
Agus Hamonangan - Sejarah Android, Penetrasi/Pertumbungan, dan Peluang Smartp...Agus Hamonangan - Sejarah Android, Penetrasi/Pertumbungan, dan Peluang Smartp...
Agus Hamonangan - Sejarah Android, Penetrasi/Pertumbungan, dan Peluang Smartp...
 
ID Android Dev Talk - Observer Pattern, Event Bus Usage, Firebase & Geofire
ID Android Dev Talk  - Observer Pattern, Event Bus Usage, Firebase & GeofireID Android Dev Talk  - Observer Pattern, Event Bus Usage, Firebase & Geofire
ID Android Dev Talk - Observer Pattern, Event Bus Usage, Firebase & Geofire
 

Último

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilV3cube
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 

Último (20)

Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 

Firebase Implementation in Android: Introduction to Firebase Features

  • 1. and its Implementation in Android +sidiqpermana @nouvrizky10
  • 2. A passionate developer who loves coding, teaching, travelling and diving so much. Cofounder & CIO Nusantara Beta Studio Intel Software Innovator Google Developer Expert
  • 3. Introduction to Firebase Firebase is a mobile platform that helps you quickly develop high-quality apps, grow your user base, and earn more money. Firebase is made up of complementary features that you can mix-and-match to fit your needs.
  • 4.
  • 5. Firebase has shifted from the Backend as a Service to Unified App Platform
  • 6. Forget about the backend and infrastructure complexity Easy to Track the app Analytics and Free forever Run on Your beloved languages! Makes your life app development easier
  • 7. Let’s Talk About Firebase Code
  • 8. What We’ll gonna do Sync data using the Firebase Realtime Database. Receive background messages with Firebase Notifications. Configure an application with Firebase Remote Config. Track application usage flows with Firebase Analytics. Allow users to send invitations to install with Firebase Invites. Report crashes with Firebase Crash Reporting. Test your app with Firebase Test Lab. You could also try the CodeLab : https://codelabs.developers.google.com/codelabs/firebase-
  • 9. https://goo.gl/ioU9FB Go to the links to see how the app works.
  • 10. First of All : Create a Hello World New Project Go to : https://console.firebase.google.com/
  • 13. C:Program FilesJavajdk1.8.0_40bin>keytool.exe -exportcert -alias androiddebu gkey -keystore "C:/debug.keystore" -list -v -storepass android Alias name: androiddebugkey Creation date: 05 Apr 15 Entry type: PrivateKeyEntry Certificate chain length: 1 Certificate[1]: Owner: CN=Android Debug, O=Android, C=US Issuer: CN=Android Debug, O=Android, C=US Serial number: 1832afe8 Valid from: Sun Apr 05 23:19:45 ICT 2015 until: Tue Mar 28 23:19:45 ICT 2045 Certificate fingerprints: MD5: CC:A1:BC:33:63:E0:BB:70:24:D2:C4:42:44:16:D1:C5 SHA1: BE:19:F6:EE:74:9F:0D:80:42:56:ED:A6:01:8B:1F:60:ED:F0:F4:24 SHA256: D6:86:58:8F:4B:57:DB:6A:57:6F:0C:1E:70:26:7F:C8:A6:C2:92:EF:7D: 72:E1:25:55:81:40:D6:EE:CE:0E:83 Signature algorithm name: SHA256withRSA Version: 3
  • 14.
  • 15. Now you app is already exist in Firebase Console. We have just integrated it. Next? Run the sample code!
  • 16. Grab the code on : $ git clone https://github.com/firebase/friendlychat Then Import the Android-Start Project to your beloved Android Studio
  • 17. Voila! The Friendly Chat is already installed in Android device. Next? We are going to set up the Authentication.
  • 18. Authenticate user { "rules": { ".read": "auth != null", ".write": "auth != null" } } Get the details : https://firebase.google.com/docs/database/security/quickstart
  • 19.
  • 20. compile 'com.google.firebase:firebase-auth:9.0.0' mFirebaseAuth = FirebaseAuth.getInstance(); mFirebaseUser = mFirebaseAuth.getCurrentUser(); if (mFirebaseUser == null) { // Not signed in, launch the Sign In activity startActivity(new Intent(this, SignInActivity.class)); finish(); return; } else { mUsername = mFirebaseUser.getDisplayName(); if (mFirebaseUser.getPhotoUrl() != null) { mPhotoUrl = mFirebaseUser.getPhotoUrl().toString(); } }
  • 21. Sign In with GoogleSignInApi Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient); startActivityForResult(signInIntent, RC_SIGN_IN);
  • 22. SignIn Callback @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); // Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...); if (requestCode == RC_SIGN_IN) { GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data); if (result.isSuccess()) { // Google Sign In was successful, authenticate with Firebase GoogleSignInAccount account = result.getSignInAccount(); firebaseAuthWithGoogle(account); } else { // Google Sign In failed Log.e(TAG, "Google Sign In failed."); } } }
  • 23. Firebase processing the credential private void firebaseAuthWithGoogle(GoogleSignInAccount acct) { Log.d(TAG, "firebaseAuthWithGooogle:" + acct.getId()); AuthCredential credential = GoogleAuthProvider.getCredential(acct.getIdToken(), null); mFirebaseAuth.signInWithCredential(credential) .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() { @Override public void onComplete(@NonNull Task<AuthResult> task) { Log.d(TAG, "signInWithCredential:onComplete:" + task.isSuccessful()); if (!task.isSuccessful()) { Log.w(TAG, "signInWithCredential", task.getException()); Toast.makeText(SignInActivity.this, "Authentication failed.", Toast.LENGTH_SHORT).show(); } else { startActivity(new Intent(SignInActivity.this, MainActivity.class)); finish(); } }}); }
  • 24. After Adding few lines of code for Authentication purpose. Now we can see that the app has functional Sign In page. Next we set up the real time database.
  • 25. Firebase Realtime Database compile 'com.google.firebase:firebase-database:9.0.0' mFirebaseDatabaseReference = FirebaseDatabase.getInstance().getReference(); That will access the database https://friendlychat- c8cfb.firebaseio.com/
  • 26. How do we send the message? FriendlyMessage friendlyMessage = new FriendlyMessage(mMessageEditText.getText().toString(), mUsername, mPhotoUrl); mFirebaseDatabaseReference.child(MESSAGES_CHILD) .push().setValue(friendlyMessage);
  • 27. Firebase Realtime Database will synch your app message. Next? Add the Firebase Cloud Messaging to the app.
  • 28. Receive the notification compile 'com.google.firebase:firebase-messaging:9.0.0' Create two service class inherit to : FirebaseMessagingService and FirebaseInstanceIdService
  • 29. Like the other chat app. The notification is a mandatory functionality. With Firebase you could do that easily by using Firebase Cloud Messaging that push your message Through GCM.
  • 30. The awesome one : Firebase Remote Config Feature Firebase Remote Config gives you instantly-updatable variables that you can use to tune and customize your app on the fly to deliver the best experience to your users. You can enable or disable features or change the look and feel without having to publish a new version. You can also target configurations to specific Firebase Analytics Audiences so that each of your users has an experience that’s tailored for them.
  • 31. Next ? We implement App Invite to Invite more users to use our app.
  • 32. Show me the code Put the dependency : compile 'com.google.firebase:firebase-config:9.0.0' // Initialize Firebase Remote Config. mFirebaseRemoteConfig = FirebaseRemoteConfig.getInstance(); // Define Firebase Remote Config Settings. FirebaseRemoteConfigSettings firebaseRemoteConfigSettings = new FirebaseRemoteConfigSettings.Builder() .setDeveloperModeEnabled(true) .build(); // Define default config values. Defaults are used when fetched config values are not // available. Eg: if an error occurred fetching values from the server. Map<String, Object> defaultConfigMap = new HashMap<>(); defaultConfigMap.put("friendly_msg_length", 10L); // Apply config settings and default values. mFirebaseRemoteConfig.setConfigSettings(firebaseRemoteConfigSettings); mFirebaseRemoteConfig.setDefaults(defaultConfigMap); // Fetch remote config. fetchConfig();
  • 33. public void fetchConfig() { long cacheExpiration = 3600; if (mFirebaseRemoteConfig.getInfo().getConfigSettings() .isDeveloperModeEnabled()) { cacheExpiration = 0; } mFirebaseRemoteConfig.fetch(cacheExpiration) .addOnSuccessListener(new OnSuccessListener<Void>() { @Override public void onSuccess(Void aVoid) { mFirebaseRemoteConfig.activateFetched(); applyRetrievedLengthLimit(); } }) .addOnFailureListener(new OnFailureListener() { @Override public void onFailure(@NonNull Exception e) { Log.w(TAG, "Error fetching config: " + e.getMessage()); applyRetrievedLengthLimit(); } }); }
  • 34. private void applyRetrievedLengthLimit() { Long friendly_msg_length = mFirebaseRemoteConfig.getLong("friendly_msg_length"); mMessageEditText.setFilters(new InputFilter[]{new InputFilter.LengthFilter(friendly_msg_length.intValue())}); Log.d(TAG, "FML is: " + friendly_msg_length); } We apply the changes in that method
  • 35. Firebase App Invite Easy to invite our friends to use our app.Next? We Implement the analytics.
  • 36. Dependency : compile'com.google.android.gms:play-services-appinvite:9.0.0' //Create the instance of GoogleApiClient mGoogleApiClient = new GoogleApiClient.Builder(this) .addApi(AppInvite.API) .enableAutoManage(this, this) .build();
  • 37. Send the Invitation through the Intent Intent intent = new AppInviteInvitation.IntentBuilder(getString(R.string.invitation_title)) .setMessage(getString(R.string.invitation_message)) .setCallToActionText(getString(R.string.invitation_cta)) .build(); startActivityForResult(intent, REQUEST_INVITE);
  • 38. The callback @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); Log.d(TAG, "onActivityResult: requestCode=" + requestCode + ", resultCode=" + resultCode); if (requestCode == REQUEST_INVITE) { if (resultCode == RESULT_OK) { // Check how many invitations were sent. String[] ids = AppInviteInvitation .getInvitationIds(resultCode, data); Log.d(TAG, "Invitations sent: " + ids.length); } else { // Sending failed or it was canceled, show failure message to // the user Log.d(TAG, "Failed to send invitation."); } } }
  • 39. Implement the Firebase Analytics Similar to Google Analytics ? YES OF COURSE! Drop the dependency to lovely gradle compile 'com.google.firebase:firebase-analytics:9.0.0' Create an Instance mFirebaseAnalytics = FirebaseAnalytics.getInstance(this); Send the event Bundle payload = new Bundle(); payload.putString(FirebaseAnalytics.Param.VALUE, "sent"); mFirebaseAnalytics.logEvent(FirebaseAnalytics.Event.SHARE, payload);
  • 40. Implement Firebase Report Crashes (beta) Just the dependency : compile 'com.google.firebase:firebase-crash:9.0.0'
  • 41.
  • 42. Test App in The Cloud Firebase Test Lab lets you test your app on various types of Android devices across multiple API levels and locales. The best part is that all this testing happens automatically in the cloud without you needing to maintain a collection of test devices. Unfortunately this is the Freemium Feature :D. You should upgrade your package to Blaze.
  • 43.
  • 45.
  • 46. Firebase Dynamic Links Firebase Dynamic Links are smart URLs that dynamically change behavior to provide the best experience across different platforms. Dynamic Links can link to different content depending on the platform they're opened on. In addition, Dynamic Links work across app installs: if a user opens a Dynamic Link and doesn't have your app installed, the user can be prompted to install it; then, after installation, your app starts and can access the link. It works with App Invite. Dependency : compile 'com.google.firebase:firebase-invites:9.0.2'
  • 47. How does it look like?
  • 48. Conclusion The new Firebase platform will make your life app development becomes easier. It contains a bunch of Tools, easy to use and well documented although several of them still need enhancement. These are useful resources: https://firebase.google.com/docs/ https://codelabs.developers.google.com/codelabs/firebase-android https://www.udacity.com/course/firebase-essentials-for-android--ud009 And Give a try to Firebase :)