Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS and Android Shared HTTP Deep Linking?

I am trying to launch my native app through a URL (shared via email etc). It seems that Android only responds to HTTP deep link URLs (e.g., http://myapp.com/stuff), and that iOS only responds to non-HTTP custom deep link URLs (e.g., myapp://stuff). Has anyone found a single solution to enable both OS's to open the same URL?

Also, is it possible for iOS to use HTTP deep link URLs? Similar to how http://youtu.be will open the native iOS app. Facebook does this too.

Thanks! :)

like image 361
rohit_wason Avatar asked Apr 03 '15 15:04

rohit_wason


1 Answers

This article can be usefull "URL schemes for iOS and Android": http://fokkezb.nl/2013/09/20/url-schemes-for-ios-and-android-2/

Edited: The main idea to send user a link to a website. Using the platform detection on server we can return correct link:

function open() {

    // If it's not an universal app, use IS_IPAD or IS_IPHONE
    if (IS_IOS) {
        window.location = "myapp://view?id=123";

        setTimeout(function() {

            // If the user is still here, open the App Store
            if (!document.webkitHidden) {

                // Replace the Apple ID following '/id'
                window.location = 'http://itunes.apple.com/app/id1234567';
            }
        }, 25);

    } else if (IS_ANDROID) {

        // Instead of using the actual URL scheme, use 'intent://' for better UX
        window.location = 'intent://view?id=123#Intent;package=my.app.id;scheme=myapp;launchFlags=268435456;end;';
    }
}
like image 136
kengura Avatar answered Oct 06 '22 00:10

kengura