Android , Could we use Parse LocalDataStore for local Storage? - android

As we all know parse server being shutdown, but if i want to use parse local data store concept without any parse server interaction(without calling parse initialize(context,appkey,masterkey)) , then how could we achieve this?
Please suggest me if we can use it or not? If not , any best option apart from parse server for local data store?
Thanks in adavance!

You can't use Parse local datastore without parse backend. Objects do not get an objectid until the device is in contact with the Parse backend. Parse pinning is meant as a convenience addition to the backend; not as a replacement.
If you're now considering using ONLY parse local datastore, you should replace your solution with Core Data instead. Or consider setting up your own Parse server at i.e. Heroku.

Related

How to get data from a database and update it in app in android?

Ok i need my app to retrieve data from a DB and display it in my app, i know this can be done using XML/JSON parsing but the data is to be updated almost daily so updating XML file wont be a possibility. The server uses SQL DB, so is there any other way other than Parsing data from it? I have heard about web service getting data n returning it to the app but in my case will it work? Will ibe able to retrieve specific data i need from the server?
Thank you
Yes. You need to create one web service and deploy it on your server which query the database and return the response in JSON/XML format and then parse that response and update your app's data. That's the straight simple way.
As you said you need to do this daily, you can think of creating a Service for the task and might be you can use AlarmManager too.
Yes you can refer this link
Android (Java) Simple Send and recieve with Server - Fast Setup Challenge
Sending and receiving data from a web service using android
simple client server communication in android

External Database and Android application

I am creating an android application which records soccer scores.
I have an external mysql database created on my own host.
How do i retrieve the data from the database in order to display it in my application?
Thanks in advance!
You need to write a service hosted on your database using either php or some other language you are comfortable which exposes data as XML/JSON.
Android has HTTPURLConnection capability,using which you can query your service by passing the parameters. Your service queries database and consturcts data either as XML or JSON using libraries and returns to app.
Your app need to parse the response (if XML, using SAX/DOM or someother APIs, if JSON using Android in-buit json parser) and display. Here is an example on how to do.
If you also want to retrive the information to be used offline, you can create an empty database locally, and update it by passing SQL statements. This is not the most efficient way to do it, but it worked for me since I am not working with a huge db.
Otherwise, use HTTP connection connecting to your remote host and pass the result via JSON object.

Get Json Information? (Noob)

I'm new to both using json and developing for android, however I'm looking to learn how to retrieve information using a json api key.
Let's say this website has all the information I need. How can I access and store that information?
https://website.com/api/user/key/a015b92aec875bd24e8fdc73477bfdcr
For example it would have something like this,
{"balance":"123","due":"3426"}
To access it, you need to open HTTPS connection to the server that has that API key, which is that https address you just provided. The server will return the JSON objects for you, to parse the string data, you can use GSON. GSON will translate all the JSON objects into Java objects, and it will help you populate your pre-built Java data structures with those data
You can get the web content using the Android HTTPClient (or follow something like the guide on this page).
For storage, you need to parse the JSON - see this SO question.
For storage, either store the raw JSON in a file or create an SQLite database and store it according to your specifications.

Send data from Android app to web service

I have an Android application with a SQLite database from which I want to send some data to a webservice to store it in a database there.
How would I go about doing this? Is there a smart way of doing it?
I've thought about just extracting the data from the SQLite database and create an XML file to hold and then send the XML file to the webservice, but is there a easier/better way of doing this?
JSON is generally seen as a more efficient data format for transferring to and from mobile devices. Check out this post about how to do it. You will, of course, need a web service that can accept and interpret JSON objects.

how to integrate servlet/jsp page in android application?

I want to store & retrieve the data from android web application to MySQL through jsp/servlet.
is it possible ? how : any other way to do this things.
thanks in advance.
Probably the easiest way is to use JSP/SERVLET as a middle layer, then send HTTP requests from your Android application to it.
To retrive data:
At JSP/SERVLET [Server] side code to:
connect to the database
run an SQL query, query may contain WHERE block depending on data from POST/GET
values
At Android [Client] side code:
use a HttpPost for sending the parameter value
convert response to string
parse the data and use it as you want.
Same way you can add new entries in database.
For reference look here or you can also use HTTPConnection.

Categories

Resources