prabeengiri / DeepLinkingToNativeApp

Javascript to DeepLink to Native App
MIT License
121 stars 43 forks source link

Alternative for iOS Facebook? #3

Closed francislavoie closed 7 years ago

francislavoie commented 7 years ago

So this project is super cool, planning on using it. Problem is, I can't actually set up Universal Links in my use-case because my customers are supposed to install our solution on-prem (self-hosted) and I can't predict which domains it will be used with, since they use their own domains. It seems to me the only use-case that would work for me because of this is iOS Facebook. Is there any alternative I could use in that case that doesn't depend on a domain?

Thanks!

prabeengiri commented 7 years ago

@francislavoie As per the Universal Linking, its mostly on the App side, they should be supporting specific domain like http://abcd.com or http://abcd.com/a/*. And also you need to have Universal Link Json file in the root of your web project. So, I believe thats should be pre-defined.

Its been a while I haven't worked with Deeplinking, but I am pretty sure, things hasn't change drastically. To make deeplinking work on Facebook browser (> IOS 9.0), you need to host landing page(deeplinking page) in different domain than your main website.

In most of the cases, we will have universal linking url as dynamic, so I have them passed as query string parameter,

// NativeAppLauncher is available after you include DeeplinkingToNativeApp.js
var queryParameters = NativeAppLauncher.util.getQueryString();
var getAppURI = function () {
  return queryParameters['app_url'] ? queryParameters['app_url'] : "myapp://"; // fallback to default
};

var getUniversalLinkURL = function () {
   return queryParameters['universal_linking_url'];
};

/** Initialize Deeplinking ***/
NativeAppLauncher.init({
   appLauncherElId: 'open-app-link',
   notSupportedMessage: 'Sorry, you'll need to use a different browser to do this.',
   universalLinkUrl: getUniversalLinkURL(),
   appUri: getAppURI(),
   androidAppId: 'com.mycompany.goapp.enterprise',
   iOsAppStore:'https://itunes.apple.com/app/apple-store/id102234234?pt=11234234234&mt=8',
   debug:false,
   campaignCode: getCampaignValue()
});

And I passed these data to DeeplinkingToNativeApp.js. This is the reason I had a separate dedicated page for deeplinking which receives the dynamic data through query string, and I passed them to the deeplinking javascript.

I hope this helps.

francislavoie commented 7 years ago

Right - that's the problem though, I can't do a * wildcard for all domains when setting up universal links at build-time of the iOS application. There isn't really a way for universal links to work in my kind of situation.

Thanks for the code example, makes sense - it's just that the URL needs to be accepted by the apps, and that's defined in the manifest. At least that's my understanding... Maybe there's a way to configure at runtime? I thought not.

Anyways, I think this issue is probably irrelevant for me anyways, because my use-case is for onboarding users via registration emails, so I doubt I'll ever run into needing it to work with facebook. This was more of a hypothetical, in case I end up using this for other purposes in the future.

Thanks 👍