I need to programmatically build a dynamic link using the Dynamic Link Builder API on Android (https://firebase.google.com/docs/dynamic-links/android/create). This is the only option applicable for my case since I need to track click data and shorten links.
This link can be opened on the desktop, but the problem is that the link will be eligible only for mobile apps - the website is unable to recognize this link (this behavior is intentional). I would like the desktop user is directed to the website's main page.
Here is the quote from Firebase doc:
When users open a Dynamic Link on a desktop web browser, they will load this URL (unless param dfl is specified). If you don't have a web equivalent to the linked content, the URL doesn't need to point to a valid web resource. In this situation, you should set up a redirect from this URL to, for example, your home page.
I see I need dfl parameter. (dfl is The link to open on desktop, overriding param link.) How can I specify dfl parameter using Dynamic Links Builder on Android?
I know that I can specify dfl by building dynamic link manually - https://firebase.google.com/docs/dynamic-links/create-manually
But this approach is not useful for me since it has such constraints:
If you don't need to track click data in the Firebase console and you don't care if the links are long...
Does anybody know the right solution or some trick to achieve this? Any thoughts/ideas would be appreciated!
Seems, that simple appending does work...
When the builder composes the Uri, I append it with &dfl=XXXXX
When I try to open this link on browser PC it directs me to URL in dfl parameter, but on the device, it opens Play Store or app (if it's installed).
The absence of such method confused me, but the solution is found.
Related
While working on a project I have a series of deep links that go to different apps (could be iOS or android). I want to validate that these urls actually go somewhere and won't result in an error. I've looked everywhere an haven't found any clear solutions.
For example the deep link
'instagram://user?username=espn'
will open up the #espn account directly in the instagram app, but
'instagram://abcd' will not do anything and should be invalid.
NOTE: this question is NOT involving the syntax or regex for deep links. Rather, I want to know how I would go about validating the deep links go somewhere (ex. for a regular url I can check that the http status code isn't 404).
I've followed the instructions from the official react-native-firebase documentation and everything, as per the instructions, works fine.
It is my understanding that I should be able to create a link like the following in the Firebase Dynamic Links console: https://myapp.page.link/offer?offerid=123456 and be able to receive the offerid parameter in my app. However, when I click that link (in the iOS simulator, Android emulator, and on a real device) the app opens, but I just get a link with the following data:
Received initial link {"minimumAppVersion": null, "url": "https://mysite.co/offers"}
There are no query string parameters attached. Am I missing something in the Firebase Dynamic Link configuration? Or in my implementation of react-native-firebase that was not covered in the documentation linked above? Or is this actually just not possible?
I think you are confusing deep links with dynamic links. Dynamic links handle your deep links to content depending upon the platform.
Example you have a deep link: https://example.com/offer?offerid=123456 .
You wish to open it in your app depending upon the platform.
Suppose you created a domain for dynamic link from console: https://myapp.page.link
Now you can create a dynamic link which opens the deep linked content on your app. The dynamic link can take in only specific parameters as mentioned here. However you can pass your parameters to your deep link,
https://myapp.page.link/?link=https%3A%2F%2Fexample.com%2Foffer%3Fofferid%3D123456&apn=com.example.app&ibi=com.example.app
The above dynamic link opens the deep link in your android app with package name com.example.app and ios app with bundle ID com.example.app.
I have searched SO and the web for a similar issue, and while others appear to have encountered this problem, their solutions are not working for me.
DFL parameter in Firebase Dynamic Links Builder
Starting with Android, I'm attempting to implement the Dynamic Links for my app. The app requires additional parameters on the dynamic link, so I'm manually constructing the link based on the information here: https://firebase.google.com/docs/dynamic-links/create-manually.
I have created my link in the following manner (code abbreviated for purposes of this post)
Uri.Builder builder = new Uri.Builder()
.scheme("https")
.authority(AppPrivate.Invitation.APP_CODE + ".app.goo.gl")
.path("/")
.appendQueryParameter("link", link)
.appendQueryParameter("apn", AppPrivate.PACKAGE)
.appendQueryParameter("dfl", desktopLink);
For my use case the link and desktopLink parameters are the same - they are actual working URLs on my website. Regardless of what device the user hits with the dynamic link, it should perform the desired action. Again, for purposes of simply getting this working, I've linked to our primary website (https://www.mytravelerapp.com).
When I send the invitation from my Android device, I generate an intent based on the code sample here: https://github.com/firebase/quickstart-android/blob/master/invites/app/src/main/java/com/google/firebase/quickstart/invites/MainActivity.java
return new AppInviteInvitation.IntentBuilder(context.getString(R.string.content_trip_invitation_title))
.setMessage(message)
.setDeepLink(uri)
.setCustomImage(Uri.parse(AppPrivate.Invitation.TRIP_INVITE_DEEP_LINK_IMAGE))
.setCallToActionText(context.getString(R.string.content_trip_invitation_cta))
.build();
However, when I receive the invitation via email on my desktop, it always goes to the Play Store listing, no matter what I've added to the initial deep link (DFL, AFL). Here's a sample of the link from the "call to action" button from the email:
https://a3d4u.app.goo.gl/i/225742434763-3bd2c2fa-45f0-4ed8-aca3-37760d27d971
I've not yet implemented the receivers in the android app to listen for incoming links, so I cannot confirm whether or not the deep link behaves appropriately on that platform.
Any recommendations or suggestions on what I'm missing with the desktop link are greatly appreciated.
Thanks!
You're actually wrapping a dynamic link in another dynamic link. Invites itself generates a dynamic link, which doesn't have your DFL parameter, so it is redirecting to the store.
You could try shortening the dynamic link you generate, and sharing via the regular share dialog rather than using Invites.
Consider an URL -
example.com/page
which is generated from marketing tab in Branch dashboard.
Now I use this URL to open my iOS application and also have redirect urls for desktop and Android. I append query params to my deep linked URL as below.
example.com/page?currentPage="myPage"
In my application, in branch init session I am able to get the parameters which I added manually.
Now, how can I achieve the same for redirect URL? If I add query params to Branch link then it should be passed on to my redirect URL without any SDK of Branch installed.
It should redirect to URL like below:
mydomain.com/page?currentPage="myPage"
You indicate that when you append link parameters to your Branch links and then use those links to open your iOS app, you are able to retrieve the appended parameters from the Branch SDK. Your question, if I am understanding correctly, is how to pass such query parameters to the websites that you are redirecting to when users click on Branch links from non-iOS devices.
When a Branch link is tapped and the user redirected to URLs that you have specified to be the app's (or the link's) "Android URL" or "Desktop URL," Branch will automatically append any parameters that were appended to that link.
For example, the Branch link https://ogt1.app.link/KZGUqrzBdB redirects users on Android devices and Desktops to "http://www.bing.com/search". Appending the query parameter "q=branch+metrics" to the Branch link produces the link "https://ogt1.app.link/KZGUqrzBdB?q=branch+metrics", which will automatically redirect Android and Desktop users to "http://www.bing.com/search?q=branch+metrics".
When the page you redirect to opens, you can retrieve any appended parameters in many ways. Two of the most straightforward approaches are:
In JavaScript, query window.location.href. This will return the entire referring URL, which you can then parse for the query parameters (see: How can I get query string values in JavaScript?).
Integrate the Branch Web SDK on the landing page and use Branch methods to retrieve all query parameters. This gives you the ability to read both the Branch link's predefined parameters and any appended key-value pairs - just as you are doing in your iOS app using the Branch iOS SDK. Instructions for using the Branch Web SDK can be found in the GitHub repository's readme.md file, here: https://github.com/BranchMetrics/web-branch-deep-linking
If I have misunderstood what you are asking please provide more detail. Examples and a test plan would be most helpful.
Alex from Branch.io here:
This is the default behavior for Branch URL redirects. Query parameters appended to the link are passed through verbatim.
This means if your link is http://example.com/page and it is set to redirect to http://otherdomain.com/page when the app is not installed, you can append ?currentPage="myPage" to make the final URL http://otherdomain.com/page?currentPage="myPage"
Hope that helps!
I am new to Android and am confused on what to put for the URL fields when registering a new client with the Instagram API using their web form.
I'm specifically confused as to what to put for these fields:
Website URL
Valid Redirect URIs
I am making an Android app and it doesn't have a website, so what am I supposed to be putting here?
In my search for an answer that made sense to me, I found this: http://oferei.com/2013/06/serverless-instagram-authentication/
In short, this is what one would need to know about how to fill these fields if they are registering an app that does not have its own website:
Website URL: it doesn't matter what value goes here, I used localhost
Redirect URIs: The article above specifies a custom URI scheme, but this is not supported w/ the Instagram API anymore. However, I did see that also using localhost would work here as well in this article: http://jelled.com/instagram/access-token
Not sure if that is the best practice, but it is a way to get the client ID for an Android app.