EddyVerbruggen / Custom-URL-scheme

:link: Launch your Cordova/PhoneGap app by a Custom URL scheme like mycoolapp://
1.03k stars 367 forks source link

iw there any way i can shared a deeplink through whatsapp ? or sms #158

Open correasebastian opened 8 years ago

correasebastian commented 8 years ago

I tried to send this link scmone:// through whatsapp or sms but neither he recognizes it as a link .

so far only recognized as links which have the structure http://xx.com.

any help will be very appreciate

devdudeio commented 8 years ago

It's only a clickable link when the app with the url scheme is installed on the target device. You can bypass this by sending a weblink to your website and route your target to the url scheme or the AppStore

correasebastian commented 8 years ago

hi rlech , thanks for your answer, the app is already installed , and the deeplink is working , i tested on chrome mobile and it works. but i trying to test if theres any way whatsapp or sms can detect "scmone:\" as a link , because i cant figure out how to do it, and i want to spread the word trought whastapp and sms

devdudeio commented 8 years ago

its "yourscheme://" not "yourscheme:\"

correasebastian commented 8 years ago

yeah i made a mistake writing , my bad, but is not working either. "scm://" ; whatsapp or sms not detect as a link

aniruddhasm commented 8 years ago

Hello,

I've tried the below code

 $cordovaSocialSharing.share('Sent from appname', 'Test Subject', null, 'appname://app/ideas');

I am trying to send this using social sharing but I am not getting a clickable link in my email.

Please help

Thanks,

sgilroy commented 8 years ago

For @correasebastian or anyone else struggling with this:

In general a link with a custom scheme is problematic in other apps because it may not get treated as a URL, and may not end up on a mobile device that supports your scheme (your app might not be installed or the user might receive your link on another platform/desktop). As @rlech suggests above, a good workaround is to only send http/https links and then use your web app (assuming you have one) to detect if it is running on a mobile device which might support your native app, and in that case redirect to your custom scheme. In this way, the user will get bounced from the other app (such as WhatsApp) to your app running in the mobile browser, and then finally to your native app.

In our application (Twine) we only share https:// links in emails, etc and rely on our web app to redirect to the native app. The code for redirecting looks like this:

            if (NavigatorService.isIos()) {
                $window.location.href = TWINE_APP_SCHEME + '://#' + url;
            } else {
                $window.location.href = 'intent://#' + encodeURI(url) +
                    '#Intent;package=' + TWINE_APP_ANDROID_PACKAGE + ';scheme=' +
                    TWINE_APP_SCHEME + ';launchFlags=0x10000000;end;';
            }

Note that we are using AngularJS and we extracted out platform detection to a service called NavigatorService, but this should give you an idea of how to generate redirect URLs for iOS and Android.

josephtindle1986 commented 8 years ago

Hi, Im using your deep link plugin and wanted to thank you for it. It is really awesome. I have integrated several social apps to my links. I'm having an issue however with the link to Facebook since it keep opening the website in the safari browser (my default mobile browser) instead of the app. My code looks as follows: Hack Whatsapp Account Am I doing anything wrong, you think? Thanks again!

DarshanSonavane commented 7 years ago

Hi Sgilroy,

I tried with your given code it's working on android but for ios it's not opening my application as well as if application is not present in a device then it should navigate user to app store but it remains at same position.

If you have any suggestion please help me.

I am using your following code.

if (NavigatorService.isIos()) { $window.location.href = TWINE_APP_SCHEME + '://#' + url; } else { $window.location.href = 'intent://#' + encodeURI(url) + '#Intent;package=' + TWINE_APP_ANDROID_PACKAGE + ';scheme=' + TWINE_APP_SCHEME + ';launchFlags=0x10000000;end;'; }

also i have made some changes in ios as follows:

if (DEVICE_TYPE = "iOS") { window.location.href = 'rtsmaharashtra://' + '://#' + url; }

Please revert as soon as possible

sgilroy commented 7 years ago

@DarshanSonavane If I understand your message, you are saying that the redirect does not work on iOS in the case where the native application is not installed on the device. The system I described is not going to work in the case where the native app is not installed. You should consider using Universal Links to resolve that problem.

Also, it looks like the format of the URL you are generating is wrong. You are going to end up with a URL that looks like this:

rtsmaharashtra://://#my-page