Is it possible to launch one app from another using Phonegap? We want to call a player app from a store app?
We also need the 2nd app to be able to return a variable to a script in the first app.
Cheers
Paul
Yes, it is possible but you'll probably end up needing to write a plugin to call an Android Intent. Many of the core PhoneGap API's like Camera use Intents.
http://developer.android.com/guide/topics/intents/intents-filters.html
http://wiki.phonegap.com/w/page/36753494/How%20to%20Create%20a%20PhoneGap%20Plugin%20for%20Android
Related
I've an Android and iOS app with source code. These 2 apps are created by another vendor. I need to use my cordova app to pass in some custom parameters to thesw 2 apps and launch it.
for cordova app, how do we launch native app with parameter ?
Use intent to launch the Android app while use Custom URL Scheme to start the iOS one. Both of them can take parameter.
1 As you have the source code the two apps, you need to edit the androidManifest.xml and info.plist respectively, allowing the native apps to recognize your intention.
2 change the source code for each platform, making them do something special with the parameters.
reference link
Android
https://developer.android.com/guide/components/intents-filters.html
iOS
https://developer.apple.com/library/content/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Inter-AppCommunication/Inter-AppCommunication.html
I know it's possible to communicate with native android components via the Intent call, but I'm trying to figure out how to launch an app (which is installed) through an Adobe Air application.
Currently, thanks to Ben, I know that...
var url:String = ("intent:#Intent;" +
"action=android.intent.action.MAIN;" +
"category=android.intent.category.LAUNCHER;" +
"component=com.android.settings/.Settings;" +
"end");
navigateToURL(new URLRequest(url));
...launches the Android Settings menu through an Air app, which is awesome.
But I'm trying to launch an app...and I believe the secret lies within the "component=com.android.settings/.Settings;" snippet. Does anybody know how I can modify this code to launch an installed app on a device?
My kingdom for an answer. I've scoured the internet for days searching on this.
Brad
It depends on your use case.
If there's one specific app you want to open, you can look inside that app's .apk for the <intent-filter> elements, as explained in Launch custom android application from android browser. Then craft the appropriate URL to pass to navigateToUrl().
Another possibility is to get the package name for the app you want to open and set that as the component= section of your URL. Fair warning, I'm not actually sure if that will work.
If you don't know what app you want to open at compile-time, it's harder (e.g. if you have a server-side list of applications that your AIR app may need to invoke). Launch an application from another application on Android shows how to launch an application if you only know the package name, but you'll need a native extension to enable that functionality.
I am working on an Adobe AIR app that will run on Android devices. The current issue I am facing is that I have received a jar file that contains an Android Activity that launches the camera, recognizes an image, and returns an id code back to the application letting the developer know which image was recognized. Thus, I need to launch the Activity from the AIR app and then return to the AIR app with the id code accessible. Is this possible?
I have read several answers regarding communicating with an AIR app via Android, but I haven't found any for communicating with an Activity via an AIR app.
Thanks so much!
You can start an intent on Android with navigateToURL(), details are described here:
Launching intents
For the data return, your AIR app can register a custom URI scheme which the native app can use to talk back to your app:
Custom URI scheme
Alternatively, you can use (or maybe find it somewhere) an ANE that uses startActivityForResult() native Android API to achieve two-way communication in a single call. AIR doesn't support that by itself, I believe.
I am creating an app that i would like to have apps running within it like let's say an iframe on a website. Is this possible? For example i will open my app and it will show the Gallery of the phone but while running my app, and not just by opening the gallery app which will make my app minimized. I want it exactly like an iframe, is this possible?
you can not run another app within your own application. You can do any of the following two
start the other app by sending intent message
or create the other app's features similarly in your own app.
According to your question if your need is to create a gallery then why aren't you creating a own gallery in your app? that will be more easier and flexible
You can not run another app's Activities within your app in an iframe style for security reasons, sorry.
Yes, I believe that is is possible for Apps to run cross platform if there exist a common data framework that creates a uniform standard for how data is stored and referenced. So the data can exist in the cloud but referenced via each app independently of the mobile phone platform.
Does anyone knows how can I open a native android app from a button in phonegap?
I'm creating an Activity that opens your phone apps so I need something to open the apps.
Thanks!
Create a plugin, that starts an Intent.
This blog may be a good entry:
http://tannerburson.com/blog/2012/05/28/IntentChooser-my-first-PhoneGap-Cordova-plugin/
Well if you want to open any native Android app then you'll need to write a plugin to call the apps Intent.
Although if you just want to open the Dialer app you can do:
<button onclick="document.location='tel:'">Phone</button>
and if can specify a phone number as well:
<button onclick="document.location='tel:411'">Phone</button>