Browser simulation android - java

in my app I want to simulate a browser to work in the Background.
What I need is, that the app loads a page in the background fills in a field and clicks on a button.
I searched a little and found appium and selendroid. Now I am not sure if one of those can do what I want, as I want to put it in the Play Store and it seems like both need also a pc to work with.

You can achieve this with a Webview and a Javascript bridge. Appium and Selendroid don't sound like a good match. Docs on integrating webviews here: http://developer.android.com/guide/webapps/webview.html

y dont u just create an http request object in the app instead of loading a browser window in the background?
if all u need is to fill in fields and submit a form, assuming the form is the same every time and u know the api end point u want to hit, it can be easily achieved by simply building the http request in the app and sending it out without loading a url in a browser. Think of it like a post/get request from a rest client.
Let me know if u need more clarification.

Related

How to take a webpage's content to create a native app for it? e.i not just a webview of the website

I want to create an app for a website that I don't own, like youtube or reddit. Every time I search for help, all I keep getting is how to create a webview. I've done that but that's not what I want. I want to take the website's content and create an app with it, like create my own buttons and such. I want to convert a website into an app.
I was thinking of somehow loading the website in the background and creating activities/buttons/intents that basically do what the webpage does but I don't know how to go about that or if there's a better way.
Thank you in advance.
Please let me know if clarification is needed.
Alright i got -3 votes for some reason and it has been 12 hours since i posted this question, i'm guessing the question has been consumed by the abyss of questions by now.
I made a reddit post and got some responses:
one user:
The term you’re looking for is “web scraping“ or “site scraping”. I think that’s probably what you need to research before you’re ready to handle how to make that into an app.
That’s a good starting point and once you have the content from scraping, making the app is no different than any other app.
second user:
If the website has a public (or private) API, you can use your buttons and networking calls to their API to build your client app. You are building a "YouTube client" in this case using the YouTube API.
If they dont have an API and you don't want to display their website, what you are doing is trying to reverse engineer their website and hijack the UI which is not a good practice and may even be illegal depending on the site and terms.
third user:
#second user is right on the money, but one thing I'll like to add is, the goal is to get data off of the website so that you can use in your app. An API is one (convenient) way of doing that but others are,
RSS or similar feed content (prefer this if there website supports)
HTML scraping
The above two will require you store the data somewhere else (and possible expose an API instead) because of technical reasons: you don't have access to older entries in RSS feeds and it's atrocious to keep on scraping everytime you need to access the website data. They can be done on the client (mobile app) but are best done on a server. This means you might need to get your hands dirty writing server code but you don't have to.
/thread
I'm going to do research on website scrapping and APIs to see which route i should go.
Hopefully this helped someone else.

Automating movement on a webpage

Well, I'm kinda new to mobile app development, but I have a fair amount of experience with Java. I stumbled upon CodeNameOne and thought I'd try to make an app based on "It's Learning". Unfortunately this site won't let me get straight to the logon page without going through the main portal first. So here's my question:
Is there any way (in CodeNameOne) to automate navigation on the web in the background and get information from the site, such as login and the newsfeed, then send data from the app and to the web page?
(Something like the way HtmlUnit works is what I'm looking for)
You can do some of that work using ConnectionRequest to simulate user interaction but that would probably be fragile as Andrew mentioned. The main issue is that they might change the site structure and your HtmlUnit code would break.
What we do when faced with such a situation is create a server that abstracts the "scraping" behind a set of clearly defined REST API's. That way if the site design changes we just update the server to match the change and all the clients out there will work as usual without requiring an update.
Naturally there is always a possibility of the site blocking you or even blocking your server IP address/range so Andrews advice of actually talking to the guys is sound advice.

how to Login Wordpress,get dashboard content and redirect to my android app?

So,
I am trying to make an android app for my client who has a e-commerce website. For that I have to get his details from his dashboard and somehow fetch it to graphs in the app.
For this I have to make him login, and then get his details. But till now, I am not able to get my work done. Initially I tried Login to his website through java, but failed. Then I tried Json Api as wordpress plugin , but I was told its not secure. Then I move on to phoneGap, and the login part is done.
But,now the problem is. After he login, I was not able to redirect him to my app. To overcome this, I thought to open page in IFrame and use some logic through Js/JQuery, But then Another thing come in my way as "Same-Origin-Policy". To get through this, I tried to use JSONP, which till now, I am unable to use. I don't know which PHP file to change in wordpress or what. I am now feeling so much lost, and don't know how to get this work done.
If any one could t ell me whats the best way to do this, and if please provide with explainable snippet.. It would be very much helpful
Thankyou

What is the better way to develop RSS reader for Android bassed on HTTP requests?

I'm new in development of applications for Android so I'm asking those questions for know which is better way to make RSS reader app. I have a server that downloads and stores on database news from Yahoo. On this database are stored title, content, publication date and link of news. Than I'm making HTTP POST to server to download news to Android. Data from server to android are passed in Json.
Can people, who already had developed an application like this, answer my questions?
Should I pass all list of news in one response to POST or it's better to make it's better to make several POSTs to get the same list? I'm asking this question because response from server may be too big and I don't know which is a better way to transmit it.
Comment system is the feature of my app. So need I to create a authentication system or it's possible to make it basing on ID of phone?
Another thing I need to do is to alert user when new news has appeared on server. I don't have idea how to do it with HTTP POST? Need I send to server list of nees that I have on Android?
Thank you for attention.
Here are the answers for your respective wuestions
1) This depends more on kind of UI you chose for your Android application. In my perspective you should go for multi-page (like prev-next links on bottom of screen) UI for your reader. And you should cache the results of previous page as well as next page in you app (so this also means to fetch selective results only) so that when user clicks on next/prev button the responsiveness of you application is good.
2) Ideally you app should ask for show a pop-up dialog asking to authenticate for commenting. You should use something like http://developer.android.com/reference/android/accounts/AccountManager.html to store these credentials so that from next time you do not ask the credentials again once authentication is successful.
3) In this case you should look at http://code.google.com/android/c2dm/
Polling is surely not the way to go :)
See it depends on how big your file is and more importantly how quickly do you need it.
More requests will certainly increase the latency. What generally you should go for is for one request.
But it again depends, I was once working on an android app and had the same problem. But in my case I split it into 2 requests. One so that I get initial data quickly and can disply to the user. Later with another request I can get the remaining data. So see wh1t suits you more.
Also how many requests will you have to make on an average in an hour. More polling will surely eat your battery a lot. If pushing can help you, try seeing if google's C2DM can be of any help.
For Rss parser ibm has an excellent link at http://www.ibm.com/developerworks/xml/tutorials/x-androidrss/index.html
POST vs GET - POST is meant to change state of server, whole GET is for reading results -
you should use GET to retrieve news, and POST to post comments
Use timastamp to retrieve news from some moment, update timestamp on the device
with latest received news timestamp - this will save traffic for your users and your server. First update will get everything ( you may also put a limiton amopunt of news retrieved in single batch )
everything based on something present on phone is not strong. however, you can use some kind of open id (there are a lot of providers, and most of your users will have google account) provider. In my highscore system I just hash incoming entries with some secret present in APK - this is not very secure, but data are not that valuable and there were no hack attepßts so far.
Every push alert requires active polling from device - also your application shall ask via get request something like "are there new entries since last timestamp" ( but if you already do this, you may as well just download them ) - the alert user via usual android means ( widget, status bar, vibration, playing starwars imperial march... )

How to make a P2P streaming using a web browser?

I want to create an application for P2P video transmission. In more details, I need the following:
User can switch on a web camera by clicking a button in an application.
Application starts to take images from the web camera and sends them to a certain location (given by a port and IP address).
Application starts to accept images send by another application and display them (images) in a window.
There is also one more thing. I would prefer to have everything in a browser. I know that everything can be done with Flash Player from Adobe (an example is http://chatroulette.com/).
But I would like to know if the same can be done with JavaScripts.
I am sure it the application can be written in Java. But can I use Java to have everything in a Browser.
I'm not sure that webcam access is available in any of the browsers natively yet so you might be out of luck for a pure js solution. I think there's meant to be something added to the spec soon though.
If you want to do it with flash (which is really the best way at present) take a look at red5 which you can run on the server to sit between the clients and deal with the video streaming.

Categories

Resources