Determining If User Installed An App (air / As3)
Solution 1:
There are a couple ways to answer this: Custom URL Scheme: https://developer.apple.com/library/ios/documentation/iphone/conceptual/iphoneosprogrammingguide/AdvancedAppTricks/AdvancedAppTricks.html ( the Communicating with Other Apps section)
This requires that the app you are attempting to up-sell does in fact implement a custom URL scheme, but it is a simple thing to implement. Once you have the URL Scheme, you can make a method that checks: canOpenURL: Returns whether an app can open a given URL resource.
- (BOOL)canOpenURL:(NSURL *)url (in UIApplication)
If you want more significant data exchange (shared login, or some such) you could use the Keychain facility: https://developer.apple.com/library/mac/documentation/security/conceptual/keychainServConcepts/iPhoneTasks/iPhoneTasks.html
Solution 2:
You can do this with java by quering the PackageManager class. In Java, that would look something like this:
isAppInstalled("your.package.name.here");
private boolean isAppInstalled(String packageName) {
PackageManager pm = getPackageManager();
boolean installed = false;
try {
pm.getPackageInfo(packageName, PackageManager.GET_ACTIVITIES);
installed = true;
} catch (PackageManager.NameNotFoundException e) {
installed = false;
}
return installed;
}
Since you are using AS3, you should have to build a native extension to access the PackageManager. Luckly, internet is great and someone else has done this already. you can check out this extension. Its 5 bucks, but totaly worth it. I used it to do a very similar logic.
Also, if app B is your own, you can add a new file in a SD card directory and check the existence of this file with app A.
Good luck :D
Post a Comment for "Determining If User Installed An App (air / As3)"