lampaa / com.lampa.startapp

Phonegap plugin for check or launch other application in android device.
MIT License
228 stars 120 forks source link

Get extras returned from native app #60

Open sandahaung opened 8 years ago

sandahaung commented 8 years ago

Using lampa, I could send extras to the native app. The native app also returns some extras back to the Cordova app. How can lampa know that the app that it called returned and how can I retrieve the extras included?

lampaa commented 8 years ago

Hi, @sandahaung! Hmm, your app send some extra to other app, and next, other app send some extra to your app?

rolinger commented 8 years ago

basically he, and I, are looking for callbacks.

startApp.set({  
   "application" : "com.ubercab"
}, {
   "action" : "pickup",
   "product_id" : prodID,
   "callback" : "value1,value2"
}
  1. How does/can startApp know that Uber has redirected user/info back into my app?
  2. Uber supports deeplinks, and with a deeplink an uber call would like:
var uri = "uber://action=pickup&product_id=" +prodID+ "&callback=value1,value2" 
window.open(uri,'_system','location=no') ;

When called like this, opening Uber apps works, but when I use startApp method, and move the uri parameters to the extra's object, the app fails to open. Without the extra's object, startApp.set({ "application" : "com.ubercab" }) - the app does open. But I need to be able to pass the parameters.

As well, an app like lyft does the following: (lyft: me.lyft.android) var uri = "lyft://ridetype?partner=" + partnerID + "&id=" + prodID .... " ;

How can/would startApp.set() include the "ridetype" as an extra parameter?