سؤال

I wonder if the following redirection is possible:

Let's say that a smart phone user, who has installed my phone app on his phone, follows a weblink to a target url of my designation. I want to have the target url redirect the user back to the installed phone app and go to a particular page in the app. So the procedure is

Safari|QR code scan --> my url --> open my phone app --> load target page in app.

Can this redirection be implemented for iOS and Android? I will much appreciate any information on this.

Thanks!

هل كانت مفيدة؟

المحلول

For ios, in the info.plist you can define an url scheme. You can then handle the url within the app delegate. A good tutorial is located here

http://mobiledevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html

On android you set it up as a data intent filter

<data android:host="string"
  android:mimeType="string"
  android:path="string"
  android:pathPattern="string"
  android:pathPrefix="string"
  android:port="string"
  android:scheme="string" />

http://developer.android.com/guide/topics/manifest/data-element.html

and it arrives as a data component in the intent that launches your app

<intent-filter>
 <action android:name="android.intent.action.VIEW" />
 <category android:name="android.intent.category.DEFAULT" />
 <category android:name="android.intent.category.BROWSABLE" />
     <data android:scheme="http" android:host="myhost" android:pathPrefix="/details" />
</intent-filter>

However, I'm not sure that all browsers on android actually test to see if other apps will accept the url scheme before loading it simply as the next page.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top