Getting Started with Firebase Dynamic Links on Android – Firecasts

hey Android developers I'm Sameach ndele have you heard about the magic of fire based dynamic links and want to learn how to add them into your app well look no further we're gonna give you the goods on getting started with firebase dynamic links right here in this episode

of fire casts firebase dynamic links there are deep links that work the way you want them to with a single link you can take users directly to your app on Android or iOS or to your apps Play Store or app store to install the app if it isn't

installed already and better yet that links survived the app installation process so your app can still grab the original link context after your users have finished installing your app and you can take them exactly where you want them to go in your app right after they've finished installing

it pretty cool right yes it is in fact we should build a firebase dynamic link right now now you can actually start using firebase dynamic links by completing three very simple steps sound too good to be true it's not setting up firebase dynamic links is surprisingly easy first

we'll need to do some configuration on both the firebase console and in our android project to start using firebase dynamic links next will actually create a real dynamic link and finally will receive a dynamic link in our own app an add code to handle taking the user to

the right section of our app when they click on that dynamic link now for this video we're gonna focus on steps one and two and we'll go over receiving a firebase dynamic link in the next part of this video series so stay tuned for that now before we

go into these steps to setup our firebase dynamic links it might be helpful to understand just how these links work and how they get passed into your app so let's take a moment to talk about that so one part of how firebase dynamic links work is very similar

to a plinks now you might already know app links and you might not but if not don't worry here's all you need to know about them app links provide a mapping between links on your website to your Android app this is great when you have a website with

a whole a lot of content that your users might want to view directly on the web but for which you could also provide an even deeper and more contextualized experience within your installed Android application so if a user clicks on a link pointing to your website on their

Android device and has your app installed Appling will say hmm do we want to bring this user to an Android app instead if the mapping is their app links can bring the user to your app and if your app isn't installed though just go to the website directly

one of the key things that allows appling 'kz to do this is by looking up an asset links dot JSON file this file contains the mapping for all the URL patterns from your domain that should send the user to your app and it lives at your domain name

slash well – known slash asset links dot JSON now as you might have guessed firebase dynamic links work in a very similar way to Appling 'kz based on matching URL patterns firebase dynamic links will know to take your users who click on a dynamic link to your Android

app or directly to the web now you might be thinking wait a minute I don't have aplans configured I don't have an asset link stunt JSON file no but don't worry about that you don't need to have them configured one nice thing about the way firebase dynamic links

works is that the links are hosted on a customizable subdomain that looks a little something like this note the dot page dot link subdomain firebase actually creates something like a mini website at this subdomain automatically to host your firebase dynamic links and on that mini website it also

includes an automatically generated asset links dot JSON file all ready to map your dynamic links straight to your app so you don't need to worry about creating one yourself on the other hand maybe you already are using app links in your app and you're like hey submit I

already have aplans configured can't I reuse them in firebase dynamic links the answer is yes and it's actually pretty easy to set up we'll talk about that in the second video in this series when we talk about receiving dynamic links into your app so if you are using

app links just stay tuned we've got you covered okay now that we know a bit more about how fire based dynamic links actually work I think we're ready to start creating some let's go through those three steps I mentioned to get our first firebase dynamic links working the

first step is the configuration steps both in your android project and in the firebase console now I've already set up and configured a firebase project with my Android app that I'll be working with here to set up our firebase dynamic links the project I've set up is a

language learning app called learn me walk a Native American language originating in what is now northern California if you've ever taken Android courses on Udacity it'll probably be familiar to you so I'll go ahead and use this one for this vodcast having created and configured a Fire's project

yourself yet no problem just check out this video for more details on configuring a firebase project on Android and come right back here when you're done one quick note if you do follow the video up there to create and configure your firebase project when setting up your saw

certificate fingerprints note that firebase dynamic links requires using a sha-256 fingerprint instead of a sha-1 fingerprint as shown in that video so be sure to add the sha-256 fingerprint to your project as well ok we've got a fire use project and Android app ready so let's now set

up our app to enable firebase dynamic links we'll start by first configuring our Android project so we've got our project open here in Android studio and the handy firebase developer Docs available to us first I'll need to add the firebase dynamic links dependency to my android project and

I can do that like so by copying this here dependency into my app level build our Gradle file once we've done that we just need to sync our project with the updated Gradle files and we should be ready for our next step next I'll go into the firebase

console to configure our firebase project and provide firebase with a bit more information about which domain I would like to use for my dynamic links I'll start by going to the firebase console and selecting my project next let's select dynamic links from the menu just down below here

now before you hit that big blue get started button it's important to take note of the consent form there you'll want to make sure our app is properly configured but the package name we intend to use as these will publicly be available once we start creating our first

dynamic links if you've already created a project or followed the previously mentioned video guiding you through it you should already have a package name set and ready to go if it's not one that you want to be made public after creating your first dynamic links go ahead and

change that first before moving ahead similarly if your firebase project is also connected to an iOS app you'll want to make sure the bundle ID and team ID are appropriately set otherwise let's do as the big blue box says and click get started the first thing firebase will

ask us is what's sub-domain you'd like to use for your firebase project one really cool thing to mention here is what happens if you don't want to use a dot page link sub domain but instead want to use your own domain name like my awesome company com well

here's some exciting news firebase dynamic links actually supports using your own custom domains setting up a custom domain requires a few additional configuration steps that might be too much to get into for this first getting started video so we'll use the dot page link subdomain instead don't worry

though we will be covering how to set up firebase dynamic links using custom domains in an upcoming video in this series so stay tuned for that and if you really really want to use custom domains for your dynamic links now just take out the blog post and documentation

links in the description and you'll be on your way for now we'll use a dot page link subdomain now there are a couple of things to note when you go about choosing the subdomain you want to use for your dynamic links first remember that this should be a

subdomain specific to this firebase project so rather than using something like your company name I'd recommend using something like your app name also note that depending on which domain name you choose there may be additional verification steps needed to make sure that you are indeed the owner of

the name in the sub domain name so you can't register something like YouTube page dot link you could try though in my case I've chosen learn me walk dot page dot link and you'll want to choose something that works for your project to once you've selected a suitable

name hit continue and bam your fire based dynamic link sub domain and mini webpage should be set and ready to go in fact you can even check to see that the correct asset links dot JSON file was generated by visiting this newly created webpage at the name you

chose page link slash dot well – known slash asset links dot JSON so go ahead and do that now for our learn Miwok project we can see the asset link JSON file right here at learn muack page link slash dot well – known slash asset links JSON the

asset links type JSON file provides a configuration for handling all URLs that are sent to this domain and redirecting to my Android app designated by the Android package name comma match on del dot Miwok if you followed up until this point in the video you should see the

same thing here in the asset link JSON file living at your firebase dynamic links subdomain with your Android package name okay now that we've created the subdomain we're going to use tested that the asset link stock JSON file was correctly created completed our configuration steps we're now ready

to move to step two creating our very first dynamic link note there are many ways to create firebase dynamic links including creating them programmatically this can be done using our client libraries or REST API s and most likely will be the way you'll create most of your own

dynamic links we'll be covering that in more detail in another video for now we'll go for the easiest and most straightforward method for creating a dynamic link creating them straight from the firebase console creating dynamic links via the console is great for when you want to create a

link that you can easily promote in a social media campaign to bring your users to a warm user experience or take them through some kind of promotion flow within your app so let's do that so now that we've got a sub-domain all we need to do is click

this nifty new dynamic link button and we're off to the races here you can see that the subdomain we've created is already filled in with the domain field and we also have a pre populated shortlink that we can go ahead and use if you are going to use

this dynamic link for promotional purposes you could change that to something more meaningful like promo or summer sale from my example I'll use the word Learn for a learning campaign and put that here and then click Next now we're presented with the section to name our dynamic link

for tracking purposes all use learn me walk since that's what I'll be using this dynamic link to help users do and then just above that we have the deep link URL box hmm what does this mean so the deep link URL is the data that actually gets passed

to your Android or iOS app when your dynamic link is clicked you might think this would be of JSON blob or something but it isn't and that's because firebase dynamic links require that your deep link is a well formatted URL that leads to an actual website so if

a user who isn't on android or iOS clicks on your dynamic link they'll be taken to a real website on their browser and still have a good experience if your company has a website with content that very closely mirrors what's in your app here would be an ideal

place to use those web page URLs as your a deep link URL parameter in fact this situation is exactly when you might want to use app links so if you already have them set up you can reuse those deep link URLs here the deeply parameter you sent here

will allow your Android or iOS app to get that deep link URL when a user clicks on your dynamic link from Android or iOS or go straight to your web page in a browser experience if they're on some other platform if you don't have real web pages that

you can map to you can just use any old URL here for your domain and redirect those back to something like your home page to make this easier you can use the same root directory for any incoming dynamic links and set up your redirect rule to redirect any

URLs to that root directory back to your home page so for my deep link URL I'll just use any old URL like HTTP colon slash slash wwe's Apple com slash and then pass in a URL parameter current page equal one and hit next which takes me to the

section for how we want the link to behave for iOS since I don't have an iOS app attached this project I'll leave this on open the deep link URL in a browser which will open the deep link URL that I specified earlier but if you did have an

iOS app you can select that here after configuring your iOS project for fire based dynamic links oh and if you're wondering how to do that check out this video here when you're ready to setup your project for iOS now I'll hit next to get into the section for

defining the link behavior for Android now there are a few options here the first option is the primary behavior I'd like this dynamic link to have for Android which would be to open my Android app so I'll select that option and then select my Android app from the

drop down like so next I can choose what I would like to have happen if the app is not installed normally this would be to take them to the Play Store to download the app but if the user who clicked the link isn't running the minimum required version

of Android to run my app or if I have a Google Play instant experience available for my app I might want to send the user there instead the Google Play Instant experience allows my user to get even faster access to the contextual call to action that would like

them to experience but I digress so let's just leave it to sending users to my Android app and move on to the last section to create our dynamic link here we have some Advanced Options we can set the first part here is for adding social meta tags that

can help improve the sharing experience for users who receive this dynamic link we can provide a title image and description for our social meta tag parameters now these tags are used in two places first they are used in many popular social networks to populate the image view and

text that will be shown in any social network posts along with this link and second they'll be shown in the preview interstitial on iOS devices that tell the user hey we're about to go to the App Store are you cool with that when they click on that link

to provide the best experience in both cases we'll definitely want to have these values filled in so let me just get these felt in all done and now let's jump to the final section below on tracking a campaign for UTM parameters these will let you specify the source

medium and name of the campaign associated with this deep link and this is used both in place to our campaign tracking and in Google Analytics for firebase finally the skip the app preview page is an option to skip that hey we're going to the App Store preview interstitial

I mentioned earlier on iOS but also as I mentioned earlier that page can be really useful to provide a better user experience so let's take their recommendation and not skip this preview page and leave this unchecked and we are cleared for takeoff I'll click on the create button

and bam we have our first dynamic link ready to go all right now there are some neat info and tools we can use to check out the details of the link we've just created and to see what flows a user who clicks on the link might see after

they click on it first by clicking on the link details section I can see the expanded dynamic link including all the URL parameters that are added on that enable the magic of fire based dynamic links whenever I create fire based dynamic links by hand this is a helpful

reference guide that'll often refer to to see what parameters I can use that I might want to add on to my link next there's also this handy link preview we can click on this to help debug our dynamic link and that will show you how the dynamic link

will behave when a user clicks on it for example in this case we can see that when an Android user clicks on the link they'll be taken to the app itself if it's already installed or to the Play Store if it's not installed already for iOS or desktop

users they'll just go straight to the web link provided in the link parameter I specified earlier ok we've configured our project and created our first dynamic link now we just need to test it out the easiest way to test a dynamic link is literally to click on from

an app like Gmail Twitter an SMS messaging app or so forth in this case I've prepared a super handy app that basically just displays the firebase dynamic link I just created on a clickable page so I'll just load that up voila the app is loaded with my clickable

dynamic link and I'll just click it and bam we've now jumped into our learn me walk language learning app and it loaded to the current page now you might have guessed that the fact that the learn me walk app is not just loading up for my dynamic link

but to the correct page means that it actually received and unpacked a dynamic link and you would be correct good catch we haven't talked about doing that part yet but as I mentioned this will be in a following video in fact it'll be in the very next video

of this series so stay tuned for that so to recap here's what we've checked out so far we've learned a little bit more about how firebase dynamic links work and then perform the needed configuration steps to enable dynamic links in our project by adding the firebase dynamic link

dependency to our android project and selecting the subdomain we want to use for our firebase dynamic links then we create our very first dynamic link in the firebase console and then test it out that it actually opens up our app next up let's look at how we can

actually receive and interpret a dynamic link in her app the critics reviews are in and it's rated 4 stars best video about links on the Internet so stick around and check it out you

Source: https://zika-news.com

See More Android: https://zika-news.com/category/android/

Hãy bình luận đầu tiên

Để lại một phản hồi

Thư điện tử của bạn sẽ không được hiện thị công khai.


*