1

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?

Jonathan Eustace
  • 2,469
  • 12
  • 31
  • 54
Sasha
  • 644
  • 8
  • 22

1 Answers1

4

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.

Rachel
  • 495
  • 3
  • 10
  • I want to make like news that I can able to update it via internet for all devices that have app and users can also with button refresh or update how to make it?second one is more near to my question – Sasha Jul 22 '14 at 07:20
  • Thank you for information i will try this and persevere but i dont even know how to integrate it(( – Sasha Jul 23 '14 at 05:49
  • What do you mean by you don't know how to integrate it? What part don't you quite understand? Possibly take a look at:- http://stackoverflow.com/questions/3505930/make-an-http-request-with-android to get started @user3770205 – Rachel Jul 23 '14 at 09:48
  • I get an API key and what should i do: Please add the following API key to your query url?Maybe like this http://developer.android.com/reference/java/net/HttpURLConnection.html?if You know please tell me because I dont found any tutorials – Sasha Jul 25 '14 at 08:36
  • Please see updated answer on how to make a API call. Then once your comfortable with this style move onto the developer site which you posted changing the url variable to your url query i.e. instead of string url = "www.somewebsite.com" yours will be http://www.faroo.com/api?q=iphone&start=1&length=10&l=en&src=news&f=json&key=YOURKEY – Rachel Jul 25 '14 at 10:07