Reputation: 167
I have two different apps, one is a native android app and other is a web app built using sencha and javascript. I need to get some information from the web app to my native app. Any idea how this communication can be done ? I am not using any webview since both are two different apps. Please let me know. I even tried cookies, local storage etc.. But seems to be the native android app cannot access the browser cookies or local storage..
Please help.
Upvotes: 1
Views: 1827
Reputation: 402
You can try the following: Run an httpd at your app. If you use cordova, you can take a look at org.chromium.socket plugin. There is an example of how to set up a local http server:
https://github.com/MobileChromeApps/mobile-chrome-app-samples/blob/master/webServer/server.js
At your webapp you issue AJAX calls (replacing html with JSON would fit very well) to localhost, where your app is running at the background. Your app will respond the requests, using JSON for instance. In the other way around, your app can make AJAX calls to the server, that can update your html/js app using websockets.
If you are not using cordova, it is even easier to build an httpd in Java:) just google around.
Upvotes: 1