0

So, we have a mobile download site that we want to bypass if the user already has our app installed, and open our app. We are using the branch javascript code to try to accomplish this task. We have our branch key where I have 'my_branch_key', and we copied the rest of the code below directly out of the branch instructions. And, of course, it is failing to redirect our mobile users. I imagine the problem is the lack of some sort of app identifier in the code, but we could not find any instructions on where to add that. Anyone know what we're missing and where we need to add it. Any advice would be greatly appreciated.

// load the Branch SDK file
(function(b,r,a,n,c,h,_,s,d,k){if(!b[n]||!b[n]._q){for(;s<_.length;)c(h,_[s++]);d=r.createElement(a);d.async=1;d.src="https://cdn.branch.io/branch-latest.min.js";k=r.getElementsByTagName(a)[0];k.parentNode.insertBefore(d,k);b[n]=h}})(window,document,"script","branch",function(b,r){b[r]=function(){b._q.push([r,arguments])}},{_q:[],_v:1},"addListener applyCode banner closeBanner creditHistory credits data deepview deepviewCta first getCode init link logout redeem referrals removeListener sendSMS setIdentity track validateCode".split(" "), 0);
branch.init('my_branch_key');
// define the deepview structure
branch.deepview(
    {
      'channel': 'mobile_web',
      'feature': 'deepview',
      data : {
        'source': 'website'
      }
    },
    {
      'open_app': true
    }
);

Additional info: We noticed an oddity when trying to test this, for a couple of our iPhone users, it seems to work perfectly, but for the rest of the iPhone users and all the android users it still fails to redirect.

Ryan McCaffrey
  • 201
  • 2
  • 15

1 Answers1

1

Alex with Branch.io here: the automatic open_app: true setting actually doesn't work in iOS 9 with Safari, due to some changes Apple made to Universal Links in iOS 9.3. This is a fairly recent change, so our docs haven't been updated quite yet. It's annoying, I agree...

The best workaround is to put a button on the page with deepviewCta(). Visitors will have to click it to open the app. We realise this is not ideal, but it's the best option for Apple's current system.

The other option you can try is enabling your own domain for Universal Link. That way whenever a URL at your domain is clicked, your app will launch immediately and the site will never even be loaded.

Alex Bauer
  • 13,147
  • 1
  • 27
  • 44
  • What browser are you using on Android? I just did some tests and it looks like `open_app: true` works as expected on the stock Android browser, but not currently on Chrome or Firefox (likely because they use Chrome Intents). If you're using the stock browser, it's possible your URL scheme is somehow misconfigured – Alex Bauer Jun 29 '16 at 17:37
  • just using stock browser I think, clicking the link off an email on the phone. Where do I configure the URL scheme? – Ryan McCaffrey Jun 29 '16 at 17:42
  • [This section](https://dev.branch.io/getting-started/sdk-integration-guide/guide/android/#register-a-uri-scheme) of the Branch integration guide covers setting up the URL scheme in your app. – Alex Bauer Jun 29 '16 at 17:46
  • oh, that is configured correctly, any idea why androids won't work? I tried on default browser as well as Chrome on my phone just now, and double checked that the key is correct, and still nothing. – Ryan McCaffrey Jun 29 '16 at 18:18
  • We probably need to take a look at your code...could you send in a [ticket](https://support.branch.io/support/home) with a link to the page that isn't working? – Alex Bauer Jun 29 '16 at 18:31
  • @MichałW. nothing has changed on the iOS front recently. Feel free to open up a new thread with whatever specific issue you're seeing and I'll jump in! – Alex Bauer Jul 27 '16 at 02:32
  • It seems to work as expected on 9.3.2 for Chrome, but not Safari. – Tony Aug 03 '16 at 00:39