Reputation: 39
I am somewhat intermediate in Swift and was wondering if it is possible to code an app that opens up another app already installed on the phone and run it in the background (eg: An app that opens up Spotify, navigates to a playlist, and starts playing music automatically all in the background while never leaving the actual app).
I am not quite sure how to go about this or if it is even possible so I apologize for my lack of code. Thanks.
Upvotes: 2
Views: 1474
Reputation: 697
The answer is no. (In background)
You can't do that, an app can't directly interact with other apps, the only ways to interact between apps are URL schemes, share extensions, action extensions and other officials Apple methods, additionally, to launch an app, you need to graphically display it.
Share extensions The share extension DOESN'T open the app, but it have sandbox access to the main app, it can set global variables for example.
Action extension The same thing of share extension but without UI.
URL schemes It opens the main app trough an URL, for Spotify for example, is spotify://, the main app has access to the path of the URL's path, query etc., but the app is opened in foreground.
App groups To use App Groups, YOU need to code both apps, it's allow to use a shared sandbox between apps and extensions, you can share UserDefaults and files.
Here you have Spotify URL schemes.
Upvotes: 6