How can i get a list of all my iphone apps (even pointers for each app will be helpful)?
I'm developing an app which contain some screen that should have a list of all my installed apps (with their icon) and the option to select one to launch it in the future depends in other function of mine.
Thanks alot!
There's no way to accomplish this, because each app is sandboxed.
You would be able to determine if select apps are installed if they have custom URL schemes. For example, the Facebook app can be launched with the custom url scheme "fb://", but these aren't guaranteed to be unique, so a different app could use a scheme that's well known to belong to another app. Also not all apps have a custom URL scheme, and you would need some master list (that would need to be constantly updated to be accurate) to check for the presence of each. So you could maybe detect a select list of well-known apps with custom URL schemes, but never get a list of all of them.
If you just wanted to detect your own apps, you could have custom URL schemes that are almost certainly going to be unique set for each app, and check for those.
You could also jailbreak your device, but I'm assuming you want this functionality in an app that is distributed on the app store, so you wouldn't be able to add functionality that requires a jailbreak to work.
EDIT:
Here's an example showing detection of the Facebook app being installed:
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"fb://"]])
{
// Handle the Facebook app being installed
}
Note however, this won't give you any information about the app. Any app developer could add the "fb://" custom url scheme to their app, which would make this falsely detect it.
If you want to find lists of custom url schemes for iOS apps, just search in Google.
another way to look at this is to present the user with all of your app in the appstore. If they have any apps installed on their device then in iOS 7 they will see a button called "Open" next to each of them.
For example you can have a UITableViewCell or a UIButton that says "Checkout Our Apps". In the code you would add this.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"itms://itunes.com/apps/sixaxisllc"]];
Replace SixAxis LLC with your iTunes developer name and when users click on it, it will launch AppStore app with only your apps are shown. (With Open or price amount next to each of them)
NOTE: test this on actual device and not in simulator
Because of the Sandboxed environment, all you can do is test if it you can open a custom URL.
Akosma Software maintains a list of popular Url on his wiki: IPhone URL Schemes.
Related
Is there a way to know any App's bundle ID or App ID which is running in the foreground? I have seen this feature in this App called Backbone, which asks user to open any App, press a button on their hardware (Which is a game controller, connected to iPhone via lightning connector) and then a link/shortcut to that App gets added in their App. It seems like they are able to establish a link between their App and other Apps, based on what I know so far it is not possible without knowing the Custom URL scheme of the App.
Anyone knows if there is another way it can be done?
Thanks in advance!
URL Schemes are the only way to communicate between apps. So, no, it's not possible to launch any other apps.
But it is possible to launch any app that registers a URL Scheme, whether it's Apple's, yours, or another developer's.
For more info, check this question discussions.
I have 2 apps and I want to know if in my app 1, the app 2 is installed (and in my app 2, check if my app 1 is installed).
I know the function :
[[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:url]]
But the problem is I have to add the urls scheme in LSApplicationQueriesSchemes in my Info.plist but maybe tomorrow I want to develop a third application and I don't want to rebuild all my apps and include my new url scheme inside my application 1 and 2.
Is it possible to check if an user has one of my application by the developer ID or something like that? Without rebuild new version of my apps just for adding 1 url scheme when I release a new app?
Thank you
You can have all your apps use the same "App Group" (google more information on how to set it up, it's easy) and you can create a NSUserDefaults suite using that group identifier.
On launch, each app could write the Appname Installed key to that NSUserDefaults suite and since it's a shared suite between your apps, others could read the value and know if Appname is installed.
The downside of this is that there's no way for your app to know when it's being uninstalled, so if it's installed once the key will show up there even if the app was removed.
The best way to do this is using URL schemes. Each of your app should register a URL scheme it can handle, and then from the other app you call canOpenURL(_:) on UIApplication to test if your app is installed.
Example:
If you have MyApp1 which has registered the URL scheme myapp1://, from your other app you can:
UIApplication.shared.canOpenURL(URL(string: "myapp1://")!)
Pay special attention to the LSApplicationQueriesSchemes key you need to add to your Info.plist. This is needed for this to work and is mentioned on the documentation page I linked above.
Contrary to the application group approach, this will correctly identify when your app is uninstalled.
I wanted, to give some identifier to the app that we create like a kiosk mode in iOS.
i.e. We make add to home screen and it has an icon on home page which browse further.
Is there any way, where I can give some identifier Name to that link of app getting created so that we can get that app access from our Native and we can provide URL Scheme for the same.
Thanks.
iOS will not give access of all the url schemas. You can refer this document where the url schemas for selected application is given :
http://wiki.akosma.com/IPhone_URL_Schemes#Phone
It may be that the only way you can achieve what you want to do is to build an app around an iOS UIWebView. You can then include the camera functionality directly in the app, although there can be issues as a UIWebview doesn't handle things like popups that Safari does.
There are a few apps which I find very helpful and want to recommend to my users inside my app. If one such app is installed, and the user taps the button, I want to launch that app. Otherwise open the app page in the App Store app.
UIApplication provides a -canOpenURL: method which I think can be used to check if an app exists on the device. With -openURL: an app can be launched. But how do I construct an NSURL to launch an app?
The apps I want to refer to don't have any special registered URL scheme, at least not that I know of. All I know is their name and app ID.
Is that possible or must the developers of these apps update their apps to support custom URL opening schemes?
It is only possible to open the app by url in case it has known registered URL scheme (it may me your application or one of the existing iOS schemes)
Here is a list of public URL schemes. This however is just a fraction of what is out there in the market. It may however be helpful for you.
If 2 other app register same url scheme, how iOS handle this?
The iOS Documentation reads:
Note: If more than one third-party app registers to handle the same URL scheme, there is currently no process for determining which app will be given that scheme.
The OSs behaviour is undefined if there are two apps registered for an URL scheme, therefore you should try to define a handler that is specific for your app to avoid this situation (e.g. awesomeMapsApp:// instead of maps://).
Actually it can be really problematic. For example, til' March 2016, an app called Grabb handles PayPal schemes so that if your app tries to open PayPal (with all the security nonce etc. within the call) it launches Grabb instead, and you can do nothing about it. Even with the openURL alertView added in iOS 9, it can still be a big security issue.
Here is what I have tested:
iOS 5: the first installed app will be chosen. If you delete first installed app, then the others will not launch unless you install again.
iOS 6: the lastest installed app will be chosen. If you delete the lastest installed app, then the previous installed app will be chosen.
It will present an UIActionSheet view allowing the user to choose which app to launch (good example are apps that handle .doc files). That's where the icon you specify is used - on the action sheet buttons when it's shown to the user