[Q] How to take data from an online database? - Java for Android App Development

Hello, I'm developing an android app that needs access to a .xml database that will be updated from time to time by various Admins.
How do I do so that, when I create a new field, it synchronized with the android application? I read about the SQLite database, but I did not understand if it can be done so that it can be changed once you have compiled the app...
PS: Sorry for my english

Firstly, you need a PHP script, or any web language script that is able to grab data from the database and echo them out on the browser.
Then your app would just need to make a HTTP request to the URL and get the data. As simple as that.
SQLite Database is Android's internal database used and created by each individual app. It has nothing to do with web's database.

XML parsing.. someone told me about it

I like the partially online/mostly offline approach... this may consume big amount of internal storage, but maybe what the OP is looking for... For accessing online database, a PHP interface is the most common, with this we can consult the online db, parse the data, insert it into the local database and work there...
Sent from my GT-S5830M using Tapatalk 2

You need a server side script in any laguage to fetch data from database. Then create a HTTP request to the url and get the data from online database.

Related

Advice on the choice of querying a remote DB

Hello everyone,
I come to you for some advice about an application I'm developing for Android 1.6 and higher.
Specifically, this application must be able to query a remote MySQL database and display the retrieved data. It need also be able to UPDATE data on this databse and that is where things get complicated ...
For selection queries, I wrote a small PHP script on the remote server that retrieves the desired data in the database and encodes them in JSON. From my Android application, I have no problem to retrieve, process and display them.
Now I wonder about the solution (if there is one ...) to run UPDATE from my application on the remote database. For now, I see only two solutions:
- Develop a webService on the server with an update method. Several problems with that: it seems webServices on Android are not easy (not native, have to go through external libs). Moreover, as it's UPDATE query, I want to make sure nobody else can use this webService.
- Alternatively, write a PHP script that makes the UPDATE and call it via HTTP. Same problem as webService: I want to secure this call to be sure that only I can use this script. These scripts can be integrated into an application already present on my server and which is secured by login / password. So, if it is possible to manage PHP sessions from Android, it's won! but Ican't find anything about it ...
What do you think? Ideas?
Thx!

Commerce Application

Hello,
Early apologies if this is an incorrect forum but it's what i found about app development. If so can someone link me to something relevant?
I am going to preface this post by saying I have been using OOP languages for a long time now yet all localized self contained programs usually in python. I've gotten fairly used to some of the android API and parsing XML data to java and the reverse however I'm completely ignorant when it comes to php parsing.
I'm working on an android project for a client. I want to do an commerce application. Starting off I have already established XML UI's for a logging in, new user, main menu, and product search page. My main concern at this point is getting the remote data. Please correct me if I'm wrong but this was my plan for data handling.
Three different PHP scripts on a remote go-daddy server to access a database that holds a user data table as well as a product data table structure is as you'd expect user:{first_name, last_name, password, ect....} product:{SKU, UPC, Name, ect...}.
One of these PHP scripts pulls data from the products table for the products activity. One compares log-in credentials for the log-in activity so people can find purchase history ect... and one inserts rows to the user table for the new user activity.
Again if this isn't optimal some advice would be helpful. If this setup works however I already have a written PHP script(again held on the remote server) that parses the data into JSON format. My next step would be to write the java for the products activity to run the script and parse the JSON back into a usable format. Is there a specific java library to do this? Any UML depictions or tutorial links would be appreciated,
Secondly a big concern would be the new user script specifically how do i pass data from the java activity into the php "Insert script" i've read some on GET and it seems to be applicable to html but not java also this would be stupid for password security. again any help on any of these matters would be appreciated.
Have a look at Google's Gson library. It's great.

android app, google playstore and hosting

hi there,
I am developing an android app and need to educate myself on how android apps are hosted.
So I read this site:
http://developer.android.com/distribute/googleplay/start.html[^]
and this site:
http://developer.android.com/distribute/tools/launch-checklist.html[^]
but my question is:
does my finished android app need to be uploaded and hosted on a server?
so when I finish developing it and am ready to deploy to google play store, do I upload my entire app on "my rented server" and then within google play store point to it?
for those of you that have uploaded apps to google play store I would really appreciate some help
another question: the android app I am developing when it opens retrieves a list of names from a database, I currently use XAMPP in which I have created a MYSQL database with a table that contains the names. When I am in my house, I can retrieve the list of names no problem using wifi or just 3g on my phone. However if I am outside and my XAMPP is turned on and then I try and open my app the listview of names is not populated.
Why is that? I am thinking its because my app is not hosted on a server itself, just the database with the names that are used in the listview grid is...
To put an app on the play store you need to upgrade your Google account to a developer account. This costs £20 if I remember correctly and allows you access to the developers console where you upload the finished app in apk format and fill out the description fields etc.
Sent from my HTC One using Tapatalk
thanks for your reply....
sure I had read what you mentioned on googles developer site.
what you are speaking about is uploading my app to google play store.
do you have any idea about these 2 questions I raise:
but my question is:
does my finished android app need to be uploaded and hosted on a server?
so when I finish developing it and am ready to deploy to google play store, do I upload my entire app on "my rented server" and then within google play store point to it?
for those of you that have uploaded apps to google play store I would really appreciate some help
another question: the android app I am developing when it opens retrieves a list of names from a database, I currently use XAMPP in which I have created a MYSQL database with a table that contains the names. When I am in my house, I can retrieve the list of names no problem using wifi or just 3g on my phone. However if I am outside and my XAMPP is turned on and then I try and open my app the listview of names is not populated.
Why is that? I am thinking its because my app is not hosted on a server itself, just the database with the names that are used in the listview grid is...
Click to expand...
Click to collapse
xirokx said:
thanks for your reply....
sure I had read what you mentioned on googles developer site.
what you are speaking about is uploading my app to google play store.
do you have any idea about these 2 questions I raise:
Click to expand...
Click to collapse
For the first question
does my finished android app need to be uploaded and hosted on a server?
Click to expand...
Click to collapse
I'm assuming that when you say server, you mean your own server? If so then no, you can use the Google developer console to upload your app, which uploads the app to Google's servers and therefore can be viewed through the play store (if you choose to put the app in a "published" mode).
Second question:
so when I finish developing it and am ready to deploy to google play store, do I upload my entire app on "my rented server" and then within google play store point to it?
Click to expand...
Click to collapse
Again, no. The only way to get apps to show up on the Play store is by getting a developer account and using the Google Play Developer Console to publish your app.
Third question:
another question: the android app I am developing when it opens retrieves a list of names from a database, I currently use XAMPP in which I have created a MYSQL database with a table that contains the names. When I am in my house, I can retrieve the list of names no problem using wifi or just 3g on my phone. However if I am outside and my XAMPP is turned on and then I try and open my app the listview of names is not populated.
Why is that? I am thinking its because my app is not hosted on a server itself, just the database with the names that are used in the listview grid is...
Click to expand...
Click to collapse
The database needs to be running on a live site for you to retrieve it from anywhere.
thank you so much for your help, i really appreciate it....
can you help clarify a little further please?
currently I use Eclipse to develop in, XAMPP to host my database and a fileserver that hosts my files.
So when I debug, is the process like this:
myPhone(includes apk file) --> XAMPP(stores names and URL) --> FileServer (Retrieves URL to display in my app)
I'm assuming that when you say server, you mean your own server? If so then no, you can use the Google developer console to upload your app, which uploads the app to Google's servers and therefore can be viewed through the play store (if you choose to put the app in a "published" mode).
Click to expand...
Click to collapse
so does the process when I upload my app to Googles Server look like this:
MyPhone ---> Google Server( to retrieve apk) --> FileServer (to retrieve URL to display in app)
have I understood correctly?
If so then no, you can use the Google developer console to upload your app, which uploads the app to Google's servers and therefore can be viewed through the play store
Click to expand...
Click to collapse
if the above process that includes google server is correct, is there a way I can upload my app to google server without releasing on play store for debugging purposes.
Currently I use XAMPP to host my database on my PC, does this mean I would need to upload XAMPP on google server so that it can retrieve the names and URL I have stored in the phpMyAdmin SQL database?
If the answer to the above is yes, does this mean I need to upload XAMPP to Google Server so it can connect to my FileServer?
The database needs to be running on a live site for you to retrieve it from anywhere.
Click to expand...
Click to collapse
So I take it using XAMPP means the database is not running on a "live site" ??
How can I host my database live? currently I start XAMPP then use:
localhost/phpmyadmin to log into my SQL database....
Do you mean I need to upload that SQL database to lets say my FileServer so it is live and therefore takes XAMPP out of the process and means I can access my APP (in debug mode) from anywhere?
So sorry I am confused about how google server, XAMPP and my SQL database work...
Thanks for your patience, please continue to help me...
Thank you so much
can anyone please kindly help?
thank you
xirokx said:
can anyone please kindly help?
thank you
Click to expand...
Click to collapse
Depends on what you plan to build
If it can work offline then you generally do not need to rent a server.
If you intent to make MMO online game, chat site, dating site, your own social networking site.. then you will need to rent a server.
Whether or not need a server for the above purposes. Your app is generally hosted on a Google Play server, and be visible to people with play-store apps (technically visible as your app is hard to search for at the beginning, this is another story)
If your app is more than 50mb.. Then you will need your own server. To host the package, containing any data in excess of 50mb. Google will host the first 50mb for you. Your users will have to go start your app to get the rest from your server.
You might want to have your own server for own custom licensing validation and IAP purchasing checks, only if you don't think the google's solution is sufficient.
You can also host on Amazon.
hotspot_volcano said:
Depends on what you plan to build
If it can work offline then you generally do not need to rent a server.
If you intent to make MMO online game, chat site, dating site, your own social networking site.. then you will need to rent a server.
Whether or not need a server for the above purposes. Your app is generally hosted on a Google Play server, and be visible to people with play-store apps (technically visible as your app is hard to search for at the beginning, this is another story)
If your app is more than 50mb.. Then you will need your own server. To host the package, containing any data in excess of 50mb. You might want to have your own server for own custom licensing validation and IAP purchasing checks, only if you don't think the google's solution is insufficient.
You can also host on Amazon.
Click to expand...
Click to collapse
Thanks for your reply
I was hoping for more specific answers in relation to my specific questions...
Well your later questions are more specifically hosting questions less about android related issues
Advice to you is to turn of wifi on your phone, when your are inside and see if you can access your XAMP server.
Can you ping your server IP address (not the local IP 192.168.0.X, assuming its your home server.
Does your ISP allow you to use your home Internet to host a server accessible on the internet? (as above)

[SDK] Amerra Connect: A Cloud for Clouds - ONE Universal API

Proud to release our new game-changing platform Amerra Connect, a virtual cloud platform that provides universal APIs to use other cloud services including application & database servers, social networks, file storage, media encoding/streaming, and messaging services. Request your FREE App key to try our Alpha Version SDK exclusively at AmerraConnect.com!
Getting started with Amerra Connect & our “Hello World!” Tutorial
In this tutorial, we introduce Amerra Connect’s datastore functions. One of our features, allows you to create a new attribute name and assign a string value, “Hello World“ to it. Then you request this attribute value from the Amerra Connect datastore to display it on your web page. Please learn more about this and our new release of the SDK (Alpha 0.1.6) for JAVA at doc.amerraconnect.com!
Showing a Google Map Only Take 3 Lines of Code?
When you need to render a map on your application by searching for a physical address, Amerra Connect is an easy solution - and all you need is to add three lines of code.
We have a tutorial showing how to render a Google map by searching the physical address of Rockefeller center here doc.amerraconnect.com.
If you'd like to be an Alpha Tester of our new AmerraConnect SDK 0.1.6 for PHP and Java, please visit AmerraConnect.com!

Secure MySQL editing on in-app purchase ?

Hello,
I am a beginner on Android coding.
I own a Minecraft Pocket Edition server, and I would like to create an assistant app that would include in-app purchases to get in-game ranks. As a consequence, when a player purchases something, it needs to edit my MySQL database to give him his purchase on all servers.
I though to use PHP script to do so, but anyone uncompiling the app would be able to see how it works and get ranks for free.
I would like to know a secure way to edit a MySQL database on in-app purchase.
Thanks for your help
Edit : apparently it has something to do with the RSA key we get on our dev console. If I understand, when a purchase is made, an encrypted data is sent back to our application. From the application, I have to send that encrypted data to a php script. The php script has to verify that data signature is correct using the RSA key that I have to put in my script, and use open_ssl_verify.
Did I understand or not at all ?
Thanks again

Resources