Reference: App wake-up app
H5 Wake-up app
Interesting URL Scheme
The work to be done by the evoked side (DEMOAPP):
1. Set URL scheme is just an app's logo specifically what to set a scheme corresponding to an app corresponding to the identifier is the project's build ID
2. Check if there is a corresponding value in the Info.plist file
The wake-up job is done.
In this method of Appdelegate controller, we can get the specific request information so that we can choose whether to wake the app.
-(BOOL) Application: (UIApplication *) application OpenURL: (Nsurl *) URL sourceapplication: (NSString*) sourceapplication Annotation: (ID) annotation{NSLog (@"calling Application Bundle ID:%@", sourceapplication); NSLog (@"URL scheme:%@", [URL scheme]); NSLog (@"URL query:%@", [url query]); //Customer Code returnYES;}
Wake-up work: (test)
1. Open the corresponding scheme:
One thing to keep in mind this URL needs to be added at the end of scheme://For example, set scheme is a then the URL to open is a://
- (void) awakeotherapp{NSString*customurl =@"opendemoapp://"; if([[[UIApplication sharedapplication] Canopenurl:[nsurl Urlwithstring:customurl]] {[uiapplication Sharedapplication] Openurl:[nsurl Urlwithstring:customurl]; } Else{Uialertview*alert = [[Uialertview alloc] Initwithtitle:@"URL Error"message:[nsstring stringWithFormat: @"No custom URL defined for%@", CustomURL]Delegate: Self Cancelbuttontitle:@"Ok"Otherbuttontitles:nil]; [Alert show]; } }
Call this method at the corresponding location to
After iOS9, because of the security concerns, you need to set a white list in the Info.plist file, if not set, the following error message will be wrapped:
for " opendemoapp:// " " This app isn't allowed to query for scheme Opendemoapp "
White list settings are as follows:
In the Info.plist file, add:
The value is the scheme that was previously set this is not://
H5 invoke the app's method can refer to the above link
Demo (Extract code: YSFU)
[iOS] How to invoke other Apps H5 interface call Open app