Control a webpage trough python or any other programming language - android

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!

Related

How to update mobile app UI(android and iOS) when web UI is changed

I had a requirement in our company by senior management.We are working on a business app that can create,initialise and submit a process.This is both for web and mobile.Below is the flow of the app.
User logins in to the app.
Creates a process(a process is a form) by using a drag and drop UI.
Created process is initialised and submitted for approval.
Above is the flow of the application.Now,the requirement for mobile is,once the process is created in web that has to be dynamically updated in the mobile app.
What will be the better approach for this kind of requirements.
**Note:**Please don't get confused with the term process.Creation of process is some thing like leave request process,HR processes etc which are just normal forms.
Technically speaking,need solution for a form customisation using a drag and drop that has to be updated in mobile dynamically when changes are made in web.
If I understand your question correctly, then what you want to do is keep a process in sync between the web and your app.
You have two choices. You can either make a call to your API every x seconds and check if there are any changes. The other way would be to use WebSockets which allow you to push data from the server to the client instantly. (So you when there is a change you can notify the app and update immediately).
Both ways have advantages and disadvantages, especially when scaling your app. If you want to have a "real-time" feeling in our app, I would recommend using WebSockets.
You need to have a progressive web app and try out the ionic cloud services
https://docs.ionic.io/services/deploy/
Live deployments let you publish web assets such as HTML, JS, and CSS directly to your users without going through the app store.
This lets you:
Update your application on demand.
Get new features and bug fixes to your users quickly.
But it has a price associated with it but!

How to send information to Android application from website

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.

How to text a download link to iPhone or Android Device

We are creating a landing page of sorts for our iPhone/Android app and on this page there will be a link to each of the respective app stores. However, when the user is on a computer, it's a bit cumbersome to access the app stores (particularly Apple's app store). So we would like to add a "send text message to phone" feature like Groupon does on http://www.groupon.com/mobile.
Now, my questions with this are as follows:
A) What sort of code do I need to put in to make this feature work? Is this super intensive or are there free or cheap options available out there to do this for me?
B) How does the code know whether it is an iPhone or Android that it's texting? Groupon took me immediately to the Apple store on it's link. Tried going through the source code on Groupon but it was a bit beyond my grasp.
Thanks for any help!
A few different things are needed to get this up and running:
You should use something like Twilio to programmatically send text messages
You need a page on your server (say http://mydomain.com/app_redirect) that sniffs user agents and then redirects the user to either the iOS AppStore or Android store respectively
Once you have those pieces it's fairly simple
Create landing page like groupons
When the user posts their cell phone to your server call Twilio to send out a text message containing the link http://mydomain.com/app_redirect
When user taps the link it will open a webview, which will then redirect to the correct appstore url depending on the device

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.

JQuery Mobile app generic doubts

I am new to JQuery mobile .
Need some assistance to start with.
My plan is for a mobile application( cross platform android and Iphone ) which will get and update data to a webservice. This will be a set of htmls. I need to access gallery and camera so i think it should be integrated with PhoneGap.
Now the html pages are hosted in same domain as web service. While
integrating to Phonegap would like to know whether i need to move
Html to app or keep the htmls in remote server and put a web view to
load html from there. Basically in samples i have seen the app itself
with htmls , so would like to know best strategy.
In Android app there is a hardware back button. Basically i have
a login page, home page and detail pages. While in Home page if hardware back
button is pressed , i should ask for logout . I searched but dint get
idea to handle the same.
May be i will remove camera functionality and then it will be pure
JQuery Mobile and no Phonegap. SO this will be loaded in browser
directly in device. So if in JQuery mobile only also , can this hardware back
button be handled.
Please guide me in right direction.
-Thanks in advance
mia
In reply to your first point: the practice of hosting the full html pages in a remote server is usually forbidden by the app stores (at least iOS having read the guidelines recently).
You should instead only retrieve data from the server (in the form of json/xml for instance). For this very purpose you can create your mobile app using Backbone, or any other MVC/MVVC platform.
Your base pages will be in the app -displayed by phonegap webview- along with some templates. Every time the user goes to another page, you fetch some json data from the server and then process your data with the templates to generate full html.
This process makes more sense than serving full html pages (which is then more a mobile site than a mobile app) as only the data (what is dynamic) is sent from the server, which makes the payload smaller (better for mobile devices with limited bandwidth capabilities).
For the second point, I guess you mean when the app is closed or put in the background through this back button you want to call a logout function in your app. You'll need to catch a system event, but that's not something you can handle directly in Phonegap and you'll need some native java coding for that.. but first check the phonegap plugins for such feature but I haven't seen any.
For the third point, if you say you don't want to use phonegap your 'mobile app' will become only a 'mobile site'. which is fine, but then you'll have even less control over that "back button". You'll only be able to control web events like window close (beforeunload).
It is possible to have the full HTML on the server and I have had an app approved for the iOS app store with this method. However there are obvious downsides including the fact that you lose off-line capabilities.
You can add an event listener for the back button document.addEventListener('backbutton', onBackButton, false);
As far as I know you cannot handle the back button with a mobile site.

Categories

Resources