When doing a mobile app single Sign-on, you need to click on the link in the browser to launch the app and upload the parameters to the corresponding interface in the app to process, will now be called through the browser Android and iOS app implementation process to be cured to the blog for query.
One: Call Android app via browser
1) Modify the configuration file Androidmanifest.xml and add the following configuration under activity that needs to be opened:
<intent-filter> <data android:scheme= "Ssotest"/><!--Open the application through this ssotest, which you can define yourself. - <action android:name= "Android.intent.action.VIEW"/> <category android:name= "Android.intent.category.DEFAULT"/> <category android:name= "Android.intent.category.BROWSABLE"/> </intent-filter> |
2) in HTML, add <a href= ' ssotest://' >ssotest</a> Click this link to open the app.
3) Other apps can also open the app as follows:
startactivity (new Intent (Intent.action_view, Uri.parse ("ssotest://")); |
4) If you want to pass a parameter, you can append it to the URL, for example:
<a href= ' ssotest://id=123456 ' >ssotest</a> |
5) Accept and parse the parameters and use the following code to obtain the parameters in the received activity:
This . Getintent (). Getscheme (); //Get scheme name This . Getintent (). getdatastring (); //Get the full URI path and parse the string yourself according to the format. |
Second: Call iOS app via browser
1) Modify the plist file, register the external URL
A: find the <app>info.plist of the project B: Click the plus sign behind the Information property list to select the URL from the list types C: Expand the URL types, and then expand Item0 to change the URL identifier under ITEM0 to URL Scheme D: Expand URL Scheme To modify the contents of Item0 to Ssotest (customizable) |
2) in HTML, add <a href= ' ssotest://' >ssotest</a> Click this link to open the app.
3) If you want to accept this URL in the launch app and do special processing, you can modify the APPDELEGATE.M of the projectand rewrite the OpenURL method as follows:
-(BOOL) Application: (UIApplication *) application OpenURL: (nsurl *) URL sourceapplication: (NSString *) sourceapplication annotation: (id) annotation { a defined scheme name can be obtained through [URL scheme] The entire URL path can be obtained through [url absolutestring] to parse the data passed in. } |