Android changeable database content via internet? (like news apps) - android

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.

Related

Is there a way to pass a variable to an aspx file via the url?

I am trying to write a little Android app for my daughter. The goal is to scan a book's bar code and pass the ISBN number to this website: http://www.arbookfind.com/default.aspx . The result will show if the book is part of the Accelerated Reader program and how many points the book is worth. I am trying to automate the part where the ISBN would need to be entered into the search field.
For simplicity's sake, and because I'm not a programmer, I am using MIT's App Inventor 2. I can now scan and get the ISBN but I will need to know how to format a URL to the website that will allow me to pass the ISBN to it's search page.
Is it possible to send a variable via the URL similar to index.php?myvar=testing&someothervar=somethingelse ? I've tried but perhaps I am not using the correct variable name or format for aspx. Is there an easy way to see what the variable name is in the aspx displayed page in my browser?
EDIT To clarify, I am not trying to scrape data and avoid showing ads from the site I am using to generate the results. I am wanting to pass the ISBN number to the page and have it search and display the resulting page in the phone's browser. I am also fine with a method that would populate the search field and the user would have to hit the search button if that can be accomplished easier.
I would recommend abandoning this route, as it is highly unlikely that the owners of this website will want you passing a query string to their site anyway, but rather they will most likely point you to an Application Programming Interface (API) that they provide, so that your program can connect to this service (free or paid, depending upon the company) and then you can request the book's details by providing the ISBN in the request.
There is no discovery mechanism for an .aspx page like there is for a web service to find out the names of things to pass. Even if you figure out what the name of the query string is that you could pass in for ISBN, you run the risk of the implementation being changed and your "application breaking". While this is also true of web service APIs, since APIs are the route the website providers want you to use, as opposed to screenscraping, then they generally inform their users of breaking changes or newer versions of the API via documentation.
From what I can see that page does not accept URL-variables for their search field the way google.com and other does. The page is generated through some sort of content management system (CMS) and it relies heavily on javascript to make things work. I tried doing a normal search there, and you have two issues you need to wriggle around.
First, the page redirects you to a page where you select if your a student, parent etc. It seems that it relies on some session cookie to remember the setting, but it times out pretty fast.
Second, the form uses javascript to trigger the search, and it appears to be done using AJAX, a method of using javascript to trigger actions on the server and displaying the results, without actually loading the page again. You might be able to get a hold of the javascript code used and re-engineer it for your purposes, and call that using HTTP POST and/or GET from your app, but it is a tricky path, and quite possibly not allowed by the company since you will be loading data from their site, without presenting their advertisements and thus be costing them money.

Put some values on internet to access from android

In my app a user can (only) see the values uploaded by admin.
For example. A salesman is using the app will be able to see the latest rate provided by the manger to trade.
Now the question is "where to put these values?"
I have .net webservice experience with android but I guess it wont work in this scenario,will it?
Any suggestion that the returned result be in (preferably) XML format.
It sounds like you already know how to do this. You can download and parse xml within your app. If you alreayd know how to set up the websever, the rest is easy. Limiting who can see what is just a matter of associating specific transactions with an individuals account. Then just have the phone check for updates on that transaction when the app loads (using someting like AsyncTask) or if you want to get more complicated you could push notificatinos using the android cloud service, or even use a REST model. More details are needed for a more specific answer but you can do what you want.
You can do it on your own, and build a webserver with a MySQL/PHP JSON API or you can use parse.com for a smaller project.

How to get entire news content from a news website

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

sending information and getting response in android

In my app i need something like that.In my app a user can easily be a member by signing up.Now when a user become a member then he can communicate with other members.Suppose a want to send a message(same message) to all users, same location as he is.Or it may be something like that a user want to send a message(same message) to another 5 users whom he knows.
How can i do that.
I googled may times.I thought web-service can do that job.But i didn't right way to do that.
Can anyone how can i do that with references ???
You can refer following:
Simple PHP With MySQl(To get basics, No Interaction with Android)
http://davidwalsh.name/web-service-php-mysql-xml-json
One Demo:(Interaction with Android)
http://www.codeproject.com/Articles/267023/Send-and-receive-json-between-android-and-php
Good Tutorial:(Interaction with Android)
part1-http://guruparang.blogspot.in/2012/11/connect-android-and-mysql-via-php.html
part2-http://guruparang.blogspot.in/2012/12/connect-android-and-mysql-via-php.html
Best Tutorial (Here u can get All the idea):
http://www.androidhive.info/2012/01/android-login-and-registration-with-php-mysql-and-sqlite/
Use parse.com
Download the sample app. The sample app works both locally in Android and on the server-side. It does the hardest part for you.
Just modify it to make it fit your needs.

How to use Tmdb API or any other API

i am a newbie android coder.
i am writing a practicing app to search Movie name. I have made XML and java which has a textbox for user to type movies name, but i don't know how to search this over internet!
as i know i have to use IMDb or TMDb API, but i have no idea how to use it! i found this site :
http://www.javacodegeeks.com/2010/10/android-full-app-part-2-using-http-api.html
but there is no explanation for codes. and also i didn't found any other learning.
can somebody please write a full explanation for how to use IMDb or TMDb API for newbie?
it would be a great help to new coders like me! :)
you are most likely going to interact with these api using HttpClient. Go thru those examples first, like pulling in twitter feeds etc. Then you will be ready for the specifics of IMDb. So you are going to have to
1) Determine the base request url. Maybe it is imdb.com/api (it will be in the documentation).
2) you might need to sign up for a key which you will pass over as a parameter. (also in the documentation)
3) read the documentation to determine if you are going to use get/post since it effects how you encode the parameters. One of those parameters might be the key or you might not need a key.
4) In general you should try first in browser client before writing code, just to see what is returned. Then do the same in your code before processing.
5) all http clients are much the same, but determine what you are getting back. Is is JSON, use simple_json to parse. Is it XML, then probably use a SAXParser to handle what is returned. If you have specific questions please post them. The best we can do is give you sort of an algorithm like this as to how you go about it.
Thats really all there is to it. Just make sure you know the right url, if there is a key, if the communication is via get or post, if they are using REST you will encode url without parameters usually. Then its just a matter of parsing what you get back.
The real answer is take it one step at a time. At each step, ask if you have questions. The truth is unless we have used a particular protocol no one knows up front. Trust me, just take it one step at a time, and you will be able to handle any http api.

Categories

Resources