Android app interacting/doing stuff on a website - android

First of all, i'm not that experienced a developer with android.
I recently started an project and for said project I need my app to interact with a website. Specifically I need my app to go to the page "http://tref.cals.nl/roosters/infoweb/index.php" and there auto-fill in the two text-boxes (html forms input type text to be exact) and log in.
After that it should 'click' a link to download a file and use that file later in the app.
I've looked for all kinds of solutions, but can't really find anything that I think could help. I hope on receiving solutions, or something to look for.
If there is something else you need to know to answer my question feel free to ask.
EDIT:Thanks for the answer, but sadly i must inform you that i don't own the site in question. Also I can not arrange anything with the owner. That is why I thought of my way to do it. Anyway thanks for answering and I'm sorry I that I wasn't specific enough.

The way you described might not be the most ideal way to achieve that you want.
I would recommend using some sort of api interface. Since you have a website, i assume you have a hosting service; you would need to create some sort of API request with username and password; which in turn responds with the url of a file. You could use androids asynchronous http request to do this
I would imagine it to flow something like this
Make a request to a url, which will reside on your website. You can post username and password to this url. Ex: http://yoururl.com/api/validateuser.php
Your API URL will return a download link or whatever you seem fit - using JSON or XML, or if it is just a URL, plain text should do too.
Use android's HTTP library or you can even use aquery to download this file to your local disk.
Reference:
AQuery
https://code.google.com/p/android-query/
Async HTTP
http://loopj.com/android-async-http/
Writing an API Tutorial
http://www.androidhive.info/2014/01/how-to-create-rest-api-for-android-app-using-php-slim-and-mysql-day-12-2/

Related

How to convert any social media link to redirect to their respective mobile applications?

I am planning to create a web application where people can convert their social media links so that their links will only open in the application. A great example for what I am looking for is url genius.
Notice how it creates protocol links for the corresponding links.
URL Genius almost supports most of the popular applications. I want to achieve the same functionality but was unable to find right resources.
So in a nutshell, how can I convert an ordinary link into their corresponding deeplink? Any help is appreciated.
Two options here that I would consider:
Let URL Genius’ API do the work for you and just make an app that spits out the result
Do the work to find each corresponding deeplink
There’s a good chance there’s a database of deeplink URL prefixes, but URL Genius has a list of their supported sites on their API page. There’s only around 20 types listed there, and I’m willing to bet some use the same link prefix. Based on that list’s length, I’d guess it was probably handwritten. You could put in the same research to find those prefixes yourself, or you could use their API to avoid that.
As far as converting to a deeplink, most deeplinks I’ve seen are just the original link with the new prefix replacing http(s). I would start with that, run some tests, and manually fix the ones you find don’t work. Again, assuming you want to meet URL Genius’ number of supported sites, this shouldn’t take that long because they only seem to support 20 or so sites.

Using parse on a web hosting

let me ask my question with an example:
Assume that I have some PHP files for my android app that I put it on 000webhost[dot]com; so, my question is how can I use parse (parseplatform[dot]org) in this situation?
I'm new in backend, so I'm sorry if this question is stupid!
For some reason I can't use back4app, aws, etc.
Don't worry about php language, if it's necessary I can write it in another language. (my backend logic is not complex)
If you need a simple web-site with simple backend logic, I'd do that using Express.js. Since Parse Server is essentially an Express.js middleware, you can use the same process to serve both Parse Server and the web-site.
If you prefer to use a different technology, Parse Platform provides many different sdks (https://parseplatform.org/#sdks) that you can use for many different backend technologies (including PHP), or you can connect directly to the REST (https://docs.parseplatform.org/rest/guide/) or GraphQL (https://docs.parseplatform.org/graphql/guide/) apis using any client.
When I asked this question, I didn’t know what exactly should I search until I found this amazing article. This article opened my mind, the most helpful thing that I found there, was this:
Parse is more flexible. Given the freedom to host Parse on the
server of your choice.
You can choose the self-hosting option and deploy your Parse project
on your selected server, such as Digital Ocean.
And then I found this awesome video on youtube.
Now I can run parse on my own server (vps or cloud).
I know the title of this question may not be clear, but I don’t want to change it, because someone like me doesn’t know the right keyword for research.
Hope this help someone else too.

Android application interacting with a server

Ok so, I know the question is pretty much google-able and I did google it and found out a few answers ,so I am not asking this question knowing completly nothing.
So, I have an application (Cannot specify much about what it does or is or so...) and I need to get some data from a database.
As far as I know, the Volley is the best way to go ,but I am still looking for more details.
Could anyone tell me which is the best way to go?
NOTE: I am NOT looking for code,I am looking for methods.A name would sufice ,as I can do the digging myself.Eventually links to documentations would be awesome, but again, I can find documentations.I just need to know which is the fastest way and the most optimized.
Based on your comment, it looks like there are two different aspects to your application:
Sending out the HTTP requests from your client- i.e. your android app
Processing and sending the response to these requests on the server side, by setting up a web service
Looks like you have part 1 figured out. Note that, volley is a library, similar to android HTTP library, but optimized for faster networking.
For part 2, unless you're planning to use embedded database like sqlite, you'd need to learn about writing web services to provide database access.
Spring Data JPA is one of the many ways to do it.
I hear Parse is great too, but not free.

How to Find The Link for JSON Data of a Certain Website

I just finished a tutorial on how to develop an android application that retrieves updated posts from a Blog using JSON data.
The link to the JSON data used to retrieve the posts, was the blog name ending with "/api/get_recent_summary"
How can I find the link of the JSON data for different websites?
For example the website for The Time Magazine
http://time.com
The quickest and easiest way is to use google developer tools in Google Chrome.
1st go to google developer tools. F12 or Ctrl+Shift+I or top right Ellipsis->More Tools->Developer Tools
2nd Click on the "Network" tab.
3rd click on the "XHR" sub-tab. XHR(XMLHttpRequest)
if a site uses json it will be listed under the XHR sub-tab. You can search through the different return objects, select one and use the "preview" sub-sub-tab to view it.
View JSON
View JSON URL
Although the above way is the easiest it is not the most stable way of getting the info you need. Many sites make changes to the return data without any notice. This will probably break your app...
I think what you are looking for is an API(Application programming interface). Most web APIs return json or xml. You should start by searching for the api documentation for the specific site that you want to get json data from. Example documentation for sites that have public api feeds are github api or youtub api. Many of these will require authentication in order to get the desired json response but the documentation should show you how to do it.
Using a legitimate web api is the most stable way to go. Meaning your app has less chance of randomly breaking all of the time due to feed changes, url changes... I hope this helps!
I know this is an older question, but I felt compelled to chime in. If you goal is to simply determine if a site uses JSON for data exchange, then the solution proposed by Tim is a very good solution. However, if you are looking to scrape data from an arbitrary site, there is no guarantee that the site uses JSON as data exchange, as stated by #KenanZahirovic. There are numerous sites that do not do this. Instead they embed the data into the HTML, or use XML, or some other method for getting the content to the client. There is no standard way of doing it, which is why data scraping is so difficult. It requires figuring out how data is transferred and building a client for that.
For scenarios where you need to gather data from multiple sources, you may end up with multiple clients due to the nuances between the sources. This site explains some best practices for data scraping. However, this would likely require a server-side application. Having a server-side application that gathers data and stores it in a database would make the most sense for this scenario. This way you can have a consistent API that the client hits to access the data.
An algorithm has been proposed that can scrape many sites fairly confidently. If you only want to have a client, this may or may not be the best way to go. It all depends on how much processing you want the client to do. If at all possible, try and off load processing to a server.
This answer might be way more than is required, but ,again, I felt compelled to chime in. I am sure the previous answer was sufficient. I do recommend though that you mark an answer as the accepted answer.
Best of luck!

How to make an app submit info into a webform

I was trying to write an android app to help people do easier searches on multiple websites like craiglist, ebay ..etc
I am not sure where really to start from, or the name of the technology I would be using. To make it more accurate question, these websites are all forms based that you either post stuffs or retreive stuffs through searching. How can I make my android app actually in which it will ask the user for a item name (that part I know) and then send item name to say craiglist so it gets the results back?
I was thinking of copying the url that is displayed on my broswer when I click search on any of the website and using the same link with string manipulation to include whats needed.
Is this correct? Any other ideas are I know? I am kinda all over the place, but I need a starting point.
Some sites might expose a public API for you to connect with, but that's site specific.
Sites that do not expose such a system can be "scraped", which means you're using string manipulation (as you mentioned) to parse our the data you're after.
Both ways require basic knowledge on how to perform HTTP operations, there are several ways to do this but the easiest way it to use the HttpURLConnection class as described in various tutorials on the web.
Googling for "android http GET POST tutorial" should point you in the right way to get started with your adventure :)

Categories

Resources