eshalev
eshalev

Reputation: 3265

Can I startActivityForResult from a Chrome web page on Android?

On an android phone: I would like my webpage to call my app. I am currently using https://developer.chrome.com/multidevice/android/intents .

I would then like my native app to return a value back to the webpage that called it. Is there anything like startActivityForResult that I can call from my webpage so that Android returns the result from my app to my webpage?

I could obviously redirect back to my webpage using a new browser intent with the return values encoded as query parameters, however that would force me to reload my webpage again in another browser tab (possibly in a different browser as well, if the user has more than one web browser installed on their android device). I would much rather return the value to the same web page that launched the native app.

Upvotes: 1

Views: 289

Answers (1)

David Wasser
David Wasser

Reputation: 95618

No. You cannot do this. The browser launches the App with an Intent as "fire and forget". There is no way to call startActivityForResult() and no way to return anything. You would need to use the redirect technique, or you need to use a completely different mechanism.

Upvotes: 2

Related Questions