I have a situation where I'd like for some data to be passed from a mobile web site to a native Android app. A complication is that, in the normal case, the native Android app might not be installed when the mobile web site is loaded.
Here's an example:
I am a user of ExampleApp and I want to share a particular piece of data from ExampleApp with you, who has never installed ExampleApp.
I send you an email with a link to a mobile web page that knows what piece of data you want to see when you open the link. But, since the data is only available in the native app, not the mobile web, you're taken to a page that asks you to go to Android Market and install ExampleApp.
You install ExampleApp, and ideally, you'd be taken directly to the piece of data that I shared with you.
The big problem is in the disconnect between viewing the mobile web page and the installation of ExampleApp.
I've thought about a couple solutions, but neither have been successful (that said, I could just be implementing them incorrectly):
- Set a cookie on our domain that includes the data when the mobile web page is loaded. Then, when ExampleApp is opened, start a WebView to request a page on the same domain and check the value of the cookie. Use that to determine what piece of data to show in ExampleApp.
- Use JavaScript localStorage to store a reference to the piece of data and use a WebView to get a page on that domain and request the content of localStorage from within ExampleApp.
In both these situations, it seems as though the WebView and the Browser are sandbox'd away from each other, so you can't get at the cookies/localStorage between the two.
Is there any other way to "leave a crumbtrail" or set a message that an app installed later can access from the Browser?
EDIT: Given some of the responses, I should mention that I only want you to click once on the link, NOT have to click once, install the app, then click again to open the app to the right place.