Selenium, WebDriver, HtmlUnit equivalent for android - android

This is what I'm trying to do:
1. I have a tablet and I want to connect to the university's wi-fi to access internet
2. Connection to the internet won't work unless you open a browse
3. You are automatically redirected to a university username-password page
4. You type in your university credentials and boom => you have internet
Problem??? I hate to have to put my password every single day and although chrome for android can store it I still have to open a browser, etc. etc. etc.
Solution:
Use Selenium, WebDriver, HtmlUnit or some sort of headless browser to programmatically fill in the login form in the background.
Problem 2: These headless browsers don't work on Android (Or I haven't been able to make them work)
Does anyone know of a simple headless browser that works on Android devices, one that can fill a simple form and submit it? Are there other alternatives to what I want to do?
Thx in advance for the help.
Some related Questions: HttpUnit/HtmlUnit equivalent for android, Android: Fill Form Data and Extract HTML, Html Parsing in android

How does the University validate you once you've logged in? e.g. is it based on setting cookies in your web browser? What happens if you login with another web browser once you've authenticated in the first one?
Once you know how it authenticates you, you should be able to devise a suitable approach. For instance, if it's device-wide authentication e.g. based on your mac address then perhaps you can write a simple Android app that embeds a WebView, and/or plain old HTTP request / response programming in Java. If, however, it's browser based then you either need to login (automagically) with the browser you then want to use, or find a way to insert the relevant cookie(s) into the browser that you want to use for web browsing.

Related

How to stop developers from opening my website in a WebView?

An unauthorized person has created an android app on our name, logo and showing our website content as is. It has fully functional browser experience in an app. This person is using advertisement to make money using our content.
Our Website: http://www.chittorgarh.com
Fake App: https://play.google.com/store/apps/details?id=davidjack.chittorgarh
What we did in last 2 days:
Complaint to Google. No response so far.
Sent emails to fake app publisher. No response so far.
Created our own official app using exact same way and made it live. We will start pushing it through our website soon. It’s not what we want but do not see any other option.
https://play.google.com/store/apps/details?id=ipo.chittorgarh
Question: How do disable all the traffic from the Fake App?
Tried User-Agent but no luck as it’s exactly same as someone opens the app in chrome on android.
It is basically a web browser within an app, so there isn’t any way around this, if it’s publicly accessible via the web then it’s available to anyone to access or implement within a web view.
All you can do really is create your own app, and add a message regarding the fake app on the homepage of your website.

is there a way to use existing websites as an Android app?

I need your expertise to understand how an Android App can communicate with an existing website.
Using the same web interface but should be displayed as an Android app
Using the same database, when we try searching, and the result should be displayed with in the app
Using the same authentication, so if we accept username/password on our Android app, it should use an existing website script which can authenticate and whatever is returned should be displayed in the app.
Thanks
Well you can use webview for display of pages that should be optimized for best user experience on phone, you can query the database and show response on android - for that you need to build parser on webpage that can accept some sort of query and return response in for example json or xml format. The same goes for authentication, it is very simple actually
As per my knowledge, you need to access Web Services of Website to take the data back from the Website to the App.

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.

Android App - Log into site WITHOUT authentication?

I am working on an Android login app for a service called Netclassroom. There are many for different schools (you can google for one), but I'd prefer not to share the one I'm working on. They're all the same. I want the app to log into the site using given credentials, but I'm running into a problem.
The problem is that it "does not use authentication" and the post request doesn't work? Is it even possible to log into a site like this? By that I mean that I want to enter credentials and get to the member page to parse.
You can make an app that just starts the browser on a particular URL. Here's a post that describes how to do it,
How can I open a URL in Android's web browser from my application?
Further, I think you are asking if the app can circumvent the normal web page login mechanism. Don't do that. There's a login on the web page for a reason. If your app gets around that, then it's decreasing the security that the folks that designed the web page put in place. The correct thing to do is to work with the folks that wrote the website. If they think what you are doing is acceptable, they should make their login cookie longer-lived, or allow the user / pass fields to be stored in the browser, etc.
Again, there's absolutely no rational for making the android app less secure than the browser app.

Can you share any kind of information between a web app and a native android app?

Been researching it for a couple of days, and it seems quite impossible (though highly desired).
I'm Looking for a way to anonymously identify users on our website as they later on run our mobile apps (both iphone and android, actually). At the very basic level, I'd simply generate a UID when someone visits our site, plant a cookie on their device, and then retrieve it later when our app is run. This simple implementation seems to be impossible, because the apps don't get access to the same cookie-base as the browsers (which makes sense, privacy-wise).
Also thought about using HTML5 for this purpose, which doesn't seem to provide any solution.
I Tried going the other way around and using the device id as identifier. However, seems like device id won't be available to the web server when someone visits our site.
There seems to be a perfect disconnect between data accessible from the browser, and accessible from the device itself in native apps.
Has anyone ever found a solution for this scenario?
As of my experience what you seek is almost impossible to achieve for a third party developer.
As you mention, the web browser - by default - doesn't have file-system access from the javascript context (which is where your web app will most likely run) and the cookies infrastructure isn't exposed to the application context.
What you could do is to write a plugin to the browser which might enable this one way or another. But then there is the technicality that the browsers on mobile devices usually don't support plugins and even if they did; you can't force your web app users to install the plugin :-(
Yet another, and if possible even more unlikely solution would be to try to influence the device browser project (WebKit or whatever project you wish to target) community to implement the functionality for you (good luck) :-)
A third solution and perhaps even the ethically more correct one would be to allow the user to identify him/her self optionally when using your device client application. Your client iPhone/Android application would then have a "Identify me as a client user"-button. This would of course require you to allow the user to choose a key (an e-mail address?) of his/her own when entering the web app. You'd likely need to store the key on the web server opposed to the client browser cookies.
Hope this gives you some further ideas.
Cheers
Here are some things I think would work (untested):
You can check if the user has a google account login in the browser and on the phone.
Another way would be to have them log in in both apps
Register a special url-handler which opens your android-app with an user-identifier which gets called by the webapp (see this question)
Edit: I over-read the IPhone part - #1 and #3 those answers are Android only (I think).

Categories

Resources