How to send information to Android application from website - android

I have to write the pair of software: an website and an Android application.
The thing is: client installs the application (with all the permissions it needs). It can work in background on start-up (but don't have if it's not necessary).
Then, client visit the website. When he make certain action (click on link to some file), my application (installed previously) have to perform some operation (download the file and make something with it).
In other words, I want to send some information from my website to my application on Android.
How to achieve it in Android?
The problem is, I don't want any additional confirmation dialogs or actions from client to be required (like e.g. download file to disk, find it, run the program on it, click "accept" etc. etc.).
Of course, the installation of application will be typical, with all the confirmations.
So far I was thinking about such scenario:
Application is running in background and checks if client has performed an action on my website (taking the result of http request from www.../somethingNew?user=user as an information about user actions). If so, application download the content (e.g. www.../?user=user will return the content clicked by user).
The main disadvantage: it requires that application asks website frequently.

All you need is pushnotifications. Please read about push notifications in android. If any changes in your website it will alert the user and then u can perform some operations based on it.

Related

How to serve pages inside a phonegap app from a from instead of file://

I would like to serve the pages in my phonegap app from a domain.
Like a local server inside the app.
The basic app example serve the pages from file:// and one of our integrating does not whitelist it correctly.
This is not related Cordova Whitelist
Don't.
Although it is possible to host apps from a domain, it is extremely risky and presents a poor user experience in the case of no/flaky network connectivity, and app stores may reject the app. If you must update your app outside of the app store review process, you can use various code push solutions which push code to the device instead.
Risky: MITM attacks; no ability to check certificate signature prior to download; how do you handle a partial/corrupt download of the page, etc.
Poor UX: If no network connection, nothing is present to tell the user about that. If flaky network, then the app may load for a long time, or timeout, etc., and again, there's nothing to alert the user.
App store rejection: Primarily Apple here, but they tend to reject apps that are viewed as wrappers for websites. Your app must also alert the user when there is no network connection if one is required.

How to send data from webpage to native app on mobile device, both Android and iOS?

The scenario is, a user is visiting my webpage, click the download button to download my apk package (on Android) or go to App Store (on iOS). Then install the app and open it.
What I want to do is, when the user visits my webpage, I store some data to somewhere, and when the app is installed and opened, it can somehow read the the data (so the custom url scheme doesn't work in this situation).
For example, the user is reading an article on my webpage and then he finds out that we have an native app. So he downloads the app and installs it. We hope that when he opens the app, it could automatically display the article he was just reading. Therefore, the native app needs to know the article id from the webpage.
Now I can think of two solutions to do this but have some difficulty to overcome:
When the user visits my webpage, I copy the data to system clipboard using document.execCommand('copy') and then in my app, I acquire the data from system clipboard. While, as you may know, this API are badly supported on mobile browsers due to security reasons.
Use remote server as media. Webpage sends data to the server and app fetches it. But the data is device sensitive, and I can't think of what can be used as a unique identifier for a device. Because all webpage can obtain is some navigator.userAgent information.
So, is there someone that can help me out here and find a perfect way to send the data from webpage to native app. I would be very grateful!
I think the best option you have is to :
-Store the data in a table
-Create a php page that will do the query to get the data
-Do a http query from you android/ios app to this php page, you've your data !

Control a webpage trough python or any other programming language

I want to build a videomapping which you control with an Android device.
Say, I have a webpage that is totally black, and then on the Android device, I have a WebView app which has a few buttons. Every time I click on one of those buttons, that should trigger an event in the webpage, like showing some shapes or switch colors.
I know how to write an Android app with python sl4a alongside with HTML, CSS and JS. My question is, how can I broadcast these events to a webpage, making it trigger those effects when I click on a button on the Android side, using Python or another language.
First of all, you can not trigger an event directly in a web page from any android app. What you can do, however, is from the android app store the changes into some backend storage (or server). Then the webpage can have a auto refresh, and see changes related to the backend storage (or server).
Another version of getting this kind of communication is to set up message queues. Then you would setup that the android app is pushing messages, and the webpages sets up a listener and reads messages from the queue. It can then react to the messages.
Unfortunately, I don't currently now what kind of message queues are available for android, python, ..., so you have to do a little research there. You also need to know if that message queue is somehow supported by your webpage, either in javascript or some serverside scripting of that webpage.
Hope this is enough information to get you going!

Accessing an app's web history from another app

I have some apps that I know go out to the web and pull down some pages to be displayed within the application in some type of wrapper (working in Android). I was wondering if there was a way to be able to fetch a list of those web pages, like the application's "web history".
If I could get this in a list somewhere in code that would be awesome, or otherwise just some way to view this. I suppose on the application level it would be different for every app, but if there is someway to fetch this from another app or some type of code that would be awesome!
To sum up, basically I want app A to know what pages app B (an application that I do not own) has fetched and displayed previously.
bascially I want app A to know what pages app B (an application that I do not own) has fetched and displayed previously
Fortunately, this is not directly possible, for obvious privacy and security reasons.
If App B allows you to configure a proxy server for it, then you can do so, using some proxy server that you manage that can record this info. You can even write an HTTP proxy server to fill this role.
Rooted device users can use Wireshark and equivalent to monitor all network traffic.

Android browsing event hook

for some business application scenario, we need to make an application (or a background service/daemon) that sits on an Android device and is activated when person, using any Android browser, comes to a certain website. We control the website content and can put any HTML/javascript/something else in it if needed.
So the idea is that popup window with some message/choice is presented to the user when the user visits the website and clicks something. One idea, which I don't know if it is feasible, is to listen for all HTTP requests (if this hook exists somewhere in the SDK) and recognize an URL we are interested in, which would in turn trigger our application.
Any other ideas?
Kind regards,
Bozo
One idea, which I don't know if it is feasible, is to listen for all HTTP requests (if this hook exists somewhere in the SDK) and recognize an URL we are interested in, which would in turn trigger our application.
Fortunately, this is not possible.
You are welcome to create an application that has an activity with an <intent-filter> that identifies the URL you are interested in. Depending on how the user accesses the URL in question, they may get a choice of launching your app or one of their browsers. Users, of course, are perfectly welcome to ignore your app and load up the URL in a browser.
Any other ideas?
Any solution would represent a security flaw in Android. Hence, I sincerely hope that you fail in your quest.
You could write a proxy.
Orbot uses iptables to redirect to it's proxy service but it seems that not all Android distributions have the iptables module enabled so it might only work on rooted devices.
https://gitweb.torproject.org/orbot.git/tree/HEAD:/src/org/torproject/android

Categories

Resources