opening an Instant App by a Firebase Dynamic Link with custom parameters (App Links) - firebase-dynamic-links

I'm searching for a way to open an Android Instant app in a mobile browser.
The app supports app links (deep linking in http/https).
My Android app is working as an instant app and can be opened by an app link in different apps that are not browsers (Gmail, Whatsapp, etc.).
I have concluded that the only way to be able to have an instant experience in browser apps is by using Firebase Dynamic Links.
The only way it works is by using short Firebase Dynamic Links (without app parameters in the link). I need to be able to build the link manually with parameters, so the app will know it's desired actions.
In order to use Firebase Dynamic Links, I've:
set up all basic requirements in my app for Firebase Dynamic Links.
set up a sub-domain and enabled it in the Firebase console (the Hosting section).
created a long dynamic link manually (described as the only way to send parameters by link).
example:
https://sub.example.com/?link=https://example.com/some-path/file?param1=value1&param2=value2&apn=package.name.com
This long link works (in mobile browsers) only if the app is installed / is in cache.
If the app is not installed, the app's play store page opens and offers to install / try it (as instant app).

I've contacted Firebase support, and got a solution:
Adding the "afl" parameter in the link with the value of the app link.
Example:
https://sub.example.com/?link=https://example.com/some-path/file?param1=value1&param2=value2&apn=package.name.com**&afl=https://example.com/some-path/file?param1=value1&param2=value2**

The Android app links work properly if the user follows the following steps:
Verify that you are logged into Google, Chrome, and Google play with the account you plan to use for the instant apps.
Go into Google Play Store settings, find the tab for Instant Apps and Enable Instant Apps enable Instant Apps
In your website add html to index.html or the equivalent file where you want to place the embedded link such as this:
<!DOCTYPE html>
<html>
<body>
<h2>HTML Links</h2>
<p>HTML links are defined with the a tag:</p>
This is a link to the instant app </body>
</html>
The instant app linking will only work from links embedded within an app such as in gmail or Chrome and not from directly pasting the url in a browser navigation bar.
If you have any questions about this approach, please let me know.

Related

How do I open the deep link in mobile browser rather than mobile app in react native

What I am trying to do is opening a deep link in mobile browse (Not in app). Deeplinking is all set up, all the links with specific domains are opening/navigating into app opened from any where else. Now here is a scenario that there are some particular links with same domain (I set up deeplinking for), I want to open that in browser because I don't have any view to show for that link in my app so I want them open in browser.
I have identified the links but when I opened these links via Linking.openUrl it navigates me to the app.
if (lowerUrl.includes(PostType.NO_DEEP_LINK)) {
Linking.openURL(lowerUrl);
return null;
}
Is there any method I can specify the Linking method to open url in mobile browser not in app although the url has a same domain that is setup for deep linkg.
Solution 1#
The best possible solution for that can be using android:pathPattern in android manifest. Basically you have to provide path pattern (a sort regex) to match the valid links.
Documentation for that can be found here.
https://developer.android.com/guide/topics/manifest/data-element
Solution # 2
One has to make RN Native Module and instead Linking.openURL(lowerUrl) to handle this kind of scenario.
To make browser native module one can take help from here.
This solution doesn't work with devices which lacks google play services like Kindle Fire, etc

How to get the URI scheme of any app for AppLinks/universal linking?

I need to open a third-party app from my react native mobile app. I understand that this is called universal linking on iOS and AppLink on Android.
I have done a lot of research for this, and I have been able to set up a link to the third party app on the app store. Now I just need to get my app to open up the app if the user has it installed. That requires the URI scheme of the other app, though.
My question is, how do I get the URI scheme to this third party app? Rather, how do I get the URI scheme of any app? I know the URI scheme of the twitter app is 'twitter://app', but the app I am trying to link to is way more niche than twitter or other popular apps, so there is no help for this sort of thing online.
Any tips?
Finding the URL scheme of an iOS app
Due to Apple's tendency for secrecy, it's not easy to find the URL scheme of an iOS app. But it can be done. Here's how I do it, using a Mac app called iMazing.
Launch iMazing, select a connected iOS device, click Apps:
In the footer of the window, click Manage Apps:
Select the app you're interested in , then select Export .IPA menu item. Note: You may need to download the app first.
The saved file will have the .ipa extension. Change the extension to .zip, and unzip the file. You now have a directory with the name matching the app's name.
Assuming "asana" is the app name, open the file "asana/Payload/asana.app/Info.plist" in a text editor, and search for a section that contains "CFBundleURLSchemes". Assuming the app contains CFBundleURLSchemes (they are optional), it should look something like this:
The URL scheme is in the <string>asana</string>, so the complete url scheme in this case is "asana://". Test that the URL launches the app by typing it into iOS Safari browser window. If it works, Safari should display an alert like this:
What About Apps Without CFBundleURLSchemes?
I haven't found a way to launch apps without CFBundleURLSchemes directly, but you can link to the app's page in the App Store, where the user can open the app with the Open button (or Get button if the app is not installed).
You will need to obtain the app page's URL from the App Store:
Open App Store, go to the app's page, click the share icon:
Click Copy Link:
The URL will look like this:
https://apps.apple.com/us/app/asana-organize-tasks-work/id489969512
Clicking on that link in Safari will bring up the app page in the App Store.
Maybe it is worth to start with some background:
There are various ways to deep link into an app, and it depends on the platform (iOS\Android\WindowsPhone...) and its version.
On iOS, up until version 9, the way to open an app was by using URI schemes, e.g. the one you added above: twitter://app. Each app declares the scheme that should be used. Therefore in order to deep link into the app you wish to open, you'll need to use the scheme that it declared. This is the same for Android until version 6.
Starting iOS9+, Apple introduced Universal Links as the method for deep linking. Here's some information: https://developer.apple.com/ios/universal-links/
In these versions, URI schemes won't longer work when using Safari browser (which is the iOS default browser) if the app is not installed. If the app is installed, however, URI schemes should allow opening the app, if everything is configured successfully. In Android there's a similar method called "AppLinks".
Having said this, the above information is for setting deep link for your app. I do not think that it is a common use case to open a third party app from your app - deep links are configured and used by the app owner (e.g. for publishing his\her app to engage users).

Disable Twitter Universal Deep Links

Update: It appears Twitter has fixed this issue. Clicking the authorize button now works! Thank you all for the responses.
I have a UIWebView that opens and directs to Twitters Oauth/Authorize webpage. The user signs in with there Twitter details and authenticates the use of our application with there Twitter account. This process worked perfect before the release of Twitter 6.37 iOS application. What happens now is when the WebView detects https://twitter.com/oauth/authorize?oauth_token instead of staying in the WebView it opens the native Twitter application and dies. If you uninstall the Twitter application everything works as usually it staying within the WebView. How can I prevent this from happening? I want to stay within my UIWebView and not automatically open deep links. I have been reading about the new URL deep link changes in iOS 9, but not sure of how to stop them from my application to other native applications. Thanks for any help!
As a workaround, in twitter authentication screen we can use the Go button on iOS typing keypad instead of using the sign in button on web view until twitter fixes.
Please refer the attached screenshot link for clarity.
Screenshot for the workaround
I ran into this issue as well and figured out it was because my authorize endpoint was set to https://twitter.com/oauth/authorize?oauth_token="+oauthToken (I believe this was in the original documentation). If you add api as the subdomain: https://api.twitter.com/oauth/authorize?oauth_token="+oauthToken, it will no longer trigger the deep linking and load the twitter app.
My answer to this via a Xamarin question:
Unless Twitter removes/updates the apps section of "https://www.twitter.com/apple-app-site-association" to allow a bypass or a secondary oauth that is not in the apple-app-site-association file I do not see how you would do it. These files are signed and iOS handles them at an OS level.
I have not played around very much with the continueUserActivity delegate and the NSUserActivity object that is passed to apps launched from UNI links, but I do not see a way for the launched app (i.e. Twitter) to return control to the original app, and at that point the oauth call-chain would be broken anyway....
Unique. Unlike custom URL schemes, universal links can’t be claimed by other apps, because they use standard HTTP or HTTPS links to your website.
Secure. When users install your app, iOS checks a file that you’ve uploaded to your web server to make sure that your website allows your app to open URLs on its behalf. Only you can create and upload this file, so the association of your website with your app is secure.
Via: https://developer.apple.com/library/prerelease/ios/documentation/General/Conceptual/AppSearch/UniversalLinks.html
I would report as an issue (bug?) to Twitter's Dev forum: https://twittercommunity.com

Using Branch links to deeplink to unpublished app

I'm working as a web developer for a start-up that has a andriod app prototype. I'm not an app developer ( still learning) so I'm a little unsure how to approach this.
I wanted to deeplink the app to the webpage. I came across this solution called Branch.io . It looks like exactly what we need but I'm not sure how to link it with an unpublished app. Maybe I'm missing something. Any advice would be greatly appreciated.
The Branch service actually doesn't depend on the App or Play Store at all. The link will first try to open up the app, but fallback to the store pages if not installed. You can override this fallback to any website, and the links will still function as usual.
To test an app not in the Play Store, first choose 'Custom URL' in the Link Settings dashboard, and fill in the page you'd like to send users when the app is not installed. It's common for people to send users to either their home page or TestFlight app.
Then, to test the deep linking through install and download tracking, just do the following:
Create a Branch link
Click it on your phone or on simulator and wait to be redirected
Run the app from Android Studio/Eclipse
Here are some more testing considerations. Happy linking.

How to do FB feed share post without leaving my hybrid app?

I am making mobile app using Sencha touch which will be bundled as native app and installed on devices. In my app on certain pages I want to add "share" functionality which is supposed to post some data to user's feed. While testing on browser I can to do that by opening a window with FB sharing url like "https://m.facebook.com/dialog/feed" or "https://m.facebook.com/sharer.php" and passing all related params as explained in https://developers.facebook.com/docs/reference/dialogs/feed/
But when this app is bundled and I share with this, user is moved to browser and cannot return to app because redirect_uri cannot point to app which is why I wanted to open this dialog within my app, probably in an iFrame. This is also not possible because these dialogs are not allowed to be embedded in iframe by META tags and in order to surpass it I have to do user login which again is another dialog which I cannot open in my app's iFrame.
I also looked at sample sencha app http://blooming-day-7830.herokuapp.com/ but it also takes user to separate login page instead of opening in-app dialog.
So my questions is how does hybrid apps connect with FB without moving out user to browser?
if you decide to use PhoneGap you can try the following two options. You will have to check for the iOS version before you switch your Phonegap call to. . .
Option 1 : for iOS before 6.0
Phonegap has a pretty nifty ChildBrowser plugin that you can use to load the FB share page without leaving the app for iOS 5.0 and below.
Option 2 : for iOS 6.0+
Facebook Share functionality has now been added to iOS. So all you have to do, is call a custom plugin class that you create, and call the standard FB share code using a basic Phonegap plugin call. You won't leave the app, the ChildBrowser doesn't have to show up, instead, you'll get the stock iOS-FB share sheet that will show up, you can add pictures, text, and so on, and post to facebook.