Hello,
my game should know if another of my games is installed on the same device.
On iOS I tell the user in game #1 that for some bonus content he needs to start game #2 using a button.
Now I open game #2 using an URL scheme, when system.openURL() returns “true” (since build #968) I unlock the bonus content in game #1, otherwise I send the user directly to the App Store to download game #2. :-)
But I don’t have the slightest idea how to implement this for Android…
[And I would like not to do stuff like generating special IDs in one app that the user has to input in the other app, or setting flags in a remote server, or other awkward workarounds]
Any ideas?
Thanks & best,
Andreas
There is currently no way to do this via Corona’s Lua APIs, but this can be done in Java via Corona Enterprise. On Android, you would normally do this by finding the app by its package name by calling the PackageManager.getPackageInfo() Java method, as documented here…
http://developer.android.com/reference/android/content/pm/PackageManager.html#getPackageInfo(java.lang.String,%20int)
Hi Joshua,
thank you very much for the fast answer. Now I know I can continue with this - and when in about 6 month the project will be almost finished I will have to look again if this is already implemented for Android or I will have to switch to Enterprise.
Best,
Andreas
Andreas,
I have an alternative solution for you. As of daily build #1081 (coming soon), we’ve added the ability to display app icons belonging to the currently running Android application or other Android applications by their package name. It was intended for 3rd party Lua libraries, but this can definitely be used to detect if your app is installed on the device… at the expense of loading an image and wasting memory, but that said, app icons are not that big.
local appIcon = display.newImage("android.app.icon://my.package.name") if appIcon then -- App is installed. else -- App is not installed. end
For example, try it with package name “com.android.vending” which will fetch the Google Play app icon.
Also note that you can load app icons with this URL scheme via display.newImageRect() as well.
Anyways, I hope this helps!
Hi Joshua,
that’s it, exactly what I need. Thanks!
Best,
Andreas
There is currently no way to do this via Corona’s Lua APIs, but this can be done in Java via Corona Enterprise. On Android, you would normally do this by finding the app by its package name by calling the PackageManager.getPackageInfo() Java method, as documented here…
http://developer.android.com/reference/android/content/pm/PackageManager.html#getPackageInfo(java.lang.String,%20int)
Hi Joshua,
thank you very much for the fast answer. Now I know I can continue with this - and when in about 6 month the project will be almost finished I will have to look again if this is already implemented for Android or I will have to switch to Enterprise.
Best,
Andreas
Andreas,
I have an alternative solution for you. As of daily build #1081 (coming soon), we’ve added the ability to display app icons belonging to the currently running Android application or other Android applications by their package name. It was intended for 3rd party Lua libraries, but this can definitely be used to detect if your app is installed on the device… at the expense of loading an image and wasting memory, but that said, app icons are not that big.
local appIcon = display.newImage("android.app.icon://my.package.name") if appIcon then -- App is installed. else -- App is not installed. end
For example, try it with package name “com.android.vending” which will fetch the Google Play app icon.
Also note that you can load app icons with this URL scheme via display.newImageRect() as well.
Anyways, I hope this helps!
Hi Joshua,
that’s it, exactly what I need. Thanks!
Best,
Andreas
I want to open 3rd party application in my application…?
I Know how to handle when any application open yours application but i didn’t know how to open application
I want to open 3rd party application in my application…?
I Know how to handle when any application open yours application but i didn’t know how to open application
This returns a error if the app is not present thus breaking my loop. How can I safely check it exists or continue when it returns nil. Thanks?
This returns a error if the app is not present thus breaking my loop. How can I safely check it exists or continue when it returns nil. Thanks?
How to using for Windows Phone?
>> How to using for Windows Phone?
We don’t have a solution on WP8. You’ll have to do this yourself via .NET (ie: C# or Visual Basic).
No one over here has done this before on WP8. So, you’ll have to Google search this one for yourself.
How to using for Windows Phone?
>> How to using for Windows Phone?
We don’t have a solution on WP8. You’ll have to do this yourself via .NET (ie: C# or Visual Basic).
No one over here has done this before on WP8. So, you’ll have to Google search this one for yourself.