I hope to make use of existing functionalities in other apps on iOS in my own app. To my knowledge it should be able to be done with URL custom schemes: https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Inter-AppCommunication/Inter-AppCommunication.html
Right now in my TryingService
gluon application that are acting as a listener, I am using RuntimeArgsService
to listen for LAUNCH_URL_KEY
. And to my Default-Info.plist
file of this application I have added URL Identifier
: com.tryingservice.TryingService
, and URL Scheme
: outputHello
. How should I set up my "sender" Gluon application - to open the TryingService
application with the URL Scheme
?
In the end I made a custom service implementation to ios by following this example: http://docs.gluonhq.com/samples/gonative/
When doing this and after learning some Objective-C I noticed the BrowserService
which already had been hinted by José Pereda in the comments to the question - the similarity to my own MyService.m
Objective-C file.
After investigating this futher the check in https://bitbucket.org/gluon-oss/charm-down/src/11c36e187921/plugins/plugin-browser/ios/src/main/native/Browser.m?at=default&fileviewer=file-view-default ... if ([[UIApplication sharedApplication] canOpenURL:nsUrl])
- makes it unavailable to launch my custom URL Scheme.
By removing that if
- statement in the BrowserService
the BrowserService
can launch another app that has registered a URL-Scheme
. And it does it without launching safari/default browser can be mentioned.
So here is a Gluon app launching another Gluon app (that listens for LAUNCH_URL_KEY
with RuntimeArgsService
)
The correct format also given by José was: outputHello://<your text here>
. So I could both leave it empty or adding (a URL to a file for instance) directly after the URL-Scheme
part.
However a URL leading to an app's local storage can´t be read from another app due to iOS app Sandbox: What is Sandbox in ios , Can i Trans data between in one App to Another App in iPhone,if possible how
It should be possible to "open url with options" though as suggested here: https://developer.apple.com/documentation/uikit/uiapplicationopenurloptionskey?language=objc.
来源:https://stackoverflow.com/questions/48064507/how-can-i-open-send-a-url-to-another-app-on-ios-with-a-gluon-application