Is there a way to integrate a mobile database for your app? If so, is it extremely hard? I have not yet started on any code, I just would like to know how it can be done and the measures that encompasses such a desire to integrate a database for the android app.
I would like to do the following:
A user would like to search for a restaurant nearby...they think they know the name of the restaurant, so they begin typing letters. If they type a U, all the restaurants that start with a "U" will show up. Once they find the restaurant they are looking for, they click on it and get the information.
Can this be done?
Thank you.
AFAIK, this is how it works, company who have database need to give you a URL which takes your search term as parameter and returns either XML (or) Json as response. You need to invoke that url by appending your search terms (entered by user) with help HTTPClient API from android, which return corresponding results either XML (or) Json. If Json response you can use android JSonObject api to parse the response. If XML response, you need to use SAX/DOM parsers.
Related
From an Activity, How can I retrieve code or text from a website and display to the user ? I'm having difficulties programming back to Android, now developing as for Android 6.0 and newer. Getting deprecated about http client etc.. so I need a little of help.
Can you paste me some code example including "imports" in order to when the app load, from an Activity class, and also when a user click a "button1", to retrieve the text displayed from a web say "yahoo.es", and show a message to the user with the text from the web (loaded and parsed to a string) using Toast.
Help much appreciated in advance
Firstly you are way too ambiguous about your question. Correct me if i am wrong, what you basically want is to get data from internet and display them to user. Right.
If Yes, then the best way to do this is to get JSON response and parse it to display the relevant information onto the screen.
Take for example, you want an App displaying current Weather status of a city.Then to get the Weather data from Internet you need to connect to those websites which provide you that data.
Now one such website is OpenWeatherMap.org. You can use its APIs to retrieve data in JSON format and then display. You need to go through its API documentation.
This is link which will explain you the full process of connecting to an website's API, its retrieval of Data in Json format and ways to render and display them on screen effectively.
https://www.udacity.com/course/android-basics-networking--ud843
Hope it helps.
Hello I am beginner to Android development so I want to ask how to create dynamically changeable database (content) in Android?
I'm aware of sqlite shared preferences but how can I interact with them via internet and add new information like news apps? Could Parse help?
This is not a answer, but a comment rather, I don't have the 50 rep required to comment.
It all depends on the sort of functionality you want to achieve. I.e. do you want to be able to push new content to the device using the internet such as push notifications.
OR
Do you want the app to make a http connection to a api or your own news service on startup or on button press for example?
UPDATE
Ok you have decided you want something similar to option 2. I am not going to write code for you but I will point you in the right direction and if you get stuck, post a question.
Please take a look at:-
https://play.google.com/store/apps/details?id=com.rsoftware.news
If you have decided this is what you want or similar, this application uses an API calling infrastructure.
The API they use is called FAROO.
http://www.faroo.com/hp/api/api.html
I suggest reading the documentation, deciding if this is indeed what you want, then sign up and get a API key. Afterall it is free! enjoy coding, enjoy the errors that you will receive and persevere =).
How to make a API call
I suggest when using a API, test the queries through the browser first of all or use something like Runscope for testing their services. So first get their URL which is:-
http://www.faroo.com/api
If we were to go to this url we will get a 401 response code, which means unauthorised. This is because we haven't added our unique API key to the html query. So this url can take parameters. We simply append a ? to the end of the url and supply the parameters that FAROO offers such as:-
q which stands for query (what do you want FAROO to search for?)
start which is the number it should start from
length which is the number of results you want FAROO to return
key which is your unique to make the requests
etc etc...
So an example of a complete url would be:-
http://www.faroo.com/api?q=iphone&start=1&length=10&l=en&src=news&f=json
This url is for demonstration purposes... your own url will have a key=YourAPIKey
Also notice how the parameters are separated by & symbols i.e. q=iphone&start=1 so this part q we know stands for query which is iphone & start=1 & so on.
Hope this helps.
I am planning to make a desktop application which will have 5 regional newspapers and the user can select either of them to read it.
I need seperate colums such as Opinion,Editorial,Breaking News,Sports,etc. which means I need data of their every column.
But when I visited few papers' websites,they are just giving the headline, one line description and a link to read more as xml feed.On clicking the link the user is directed to their website.
I have seen many android applications like news Hunt ,World news,etc , which show the entire content.How do they do it?Are they using any backdoor or hack or something?
Use Jaunt Api .
The Api has easy-to-learn structure and also the code is efficient as well as fast.
You should give it a try.
Try to use a third service like
http://import.io/ or http://www.mozenda.com
As you said apps like Flipboard, Breaking news sport etc are based on services like import.io
With this you can transform information from the web into usable data easily !
Some of this app used JSON in retrieving the content from the web and pass into android app. check this link
They use an API that allows them to retrieve news (load from a server).
For example yahoo, google, etc
Not tested yet but it works (I'm sure) see yahoo API
In your case, You should write another view to display news details according to the news ID: Read their documentation carefully
Some Websites will write their own public API, which everyone can access with some HTTP header values sent. After sending HTTP request, they return the response in XML / JSON formats which you have to parse them inside your Android app and produce them on UI.
If in case they do not provide any API as such, then you need write a server side Crawler which crawls and parses the information(HTML Tagged information) from their websites and store them. Again then you need to write your own Web services(RESTful / SOAP) that send the parsed information to Android app via URL's or something.
This can be achieved using RSS feed.
visit here and see page source, here you can get all news in item tags like this
<item>
<title>..</title>
<description>...</description>
</item>
where each item tag is for each news, you can fetch both title and description from there.
and you can get data from any link using HTTPPOST or HTTPGET mehods
I'm trying to search a website for information (i.e. lets say I make an application for cinemas, the user inputs the name of the film and the cinema he wants and the application prints the times).
So in the background the application would go to the cinemas webpage, use the webpages search engine, parse the page and print a list of times.
I honestly don't know where to start so any help or tips would be most welcome.
Thank you in advance,
Aterin
After much thought I found a way of doing this, I need to use a GET with the url and fill in the url based on the input of the user.
For example on the website http://www.overclockers.co.uk/ it would be:
String url = "http://www.overclockers.co.uk/search_results.php?keywords=" + keyword + "&cat=" + cat;
and then filter the resulting HTML based on the websites CSS (in this case they have a tag for listing products, so all I need to do is search for the alt = keyword and then do another GET with the corresponding href.
There is however a serious problem with this method, if the website is altered then all this goes down the sink hole. That said, I can't think of any other solution.
You would need to first locate a suitable API to serve your data and then parse the data within your application to display it as you deem fit.
Some info on Movies API
Basically, I need to get JSON data from Git's web API. Great! Did that.
So, now I have a ListView in an android app, each list element is the title and first 140 characters from the json (jsonObject.getString("title"/"body")). When the user clicks on a list element, a dialog with all the comments in supposed to load.
So each issue (JSONObject) should have it's own comments, and indeed I can see the comments in the HTML version of the repo. However, how the heck do I download the comments in JSON form? So far, here's the "comments" element from inside the original issues JSON object:
"comments": 1,
"milestone": null,
"number": 18,
So, doing the stuff in android shouldn't be a big problem. I can detect the user's list item choice, and then get any string inside the JSON object (I figure ID is key in helping to find the comments for that issue). But, I can't figure out how I'm supposed to use GET like it says on this page under HTTP verbs (http://developer.github.com/v3/), I also can't sort out how to utilize the command as seen on this page under Get a Single comment (http://developer.github.com/v3/issues/comments/).
Lastly, I am using a PHP script on a webpage to access the original JSON. So I can envision a situation where I run another PHP script to get the comments JSON based on the list choice the user made (getID) and then work with it on the screen as need. But I can't do that without knowing how to get the comments!
Well, the url to get all the issues is something like this
https://api.github.com/repos/octocat/Hello-World/issues
as you can see you'll receive a list of issues.
After that just select the issue (let's say the number 26 that has 2 comments) and just add to the url "26/comments"
https://api.github.com/repos/octocat/Hello-World/issues/26/comments
and you'll have your comments!