heroku android beginning - android

Hi I am currently making a simple application in android that would connect to my database in Heroku and I was just wondering how I would use java code to connect to that database and fetch, and data to and from it?
Could someone give me advice on how to start. I was looking at this code for starters https://github.com/heroku/devcenter-java-database but I am still confused on how to fully understand the code. Do I need a .pom file and what is it for? And where are the values of "DATABASE_URL" and how would I be able to connect to my database that I made in Heroku etc.
Thank you for the help

Generally you wouldn't have a mobile phone connect directly to your database. You'd need to allow access to your db from the internet, its considered a bad idea for security. Instead you write a webservice that sits between your db and your client. The webservice reads the database, packages it up into some data format like XML or JSON, and sends it to the client who parses those values and does something with them (display, calculations, etc).

#Gabe Sechan is right. you need to build a API. your app will query the API and the API will get the data from db and sent back to Android via JSON...
To learn more abour API have a look here :
http://www.andrewhavens.com/posts/20/beginners-guide-to-creating-a-rest-api/
or a list of tutorials
http://blog.mashape.com/list-of-40-tutorials-on-how-to-create-an-api/
Hope this helps u buddy.

Related

How to use online database (specially on byethost7.com) in android app for inserting information?

I am making an android project which inserts information into mysql database via php code. I am able to do so on my local server (using xampp). I have taken a free webhosting byethost7.com domain http://hpisys.byethost7.com for using my database and php file from that server. I am able to open php page on internet and insert the information into the online database server. But via android app I am not able to insert information using the same php code. Please help me out of this.
If you are also using this data in a web project I would set up a RESTful service and get the data that way. If not I would use something like Firebase instead, as it will be much easier to set up.
Either way you will need to research those yourself. You should be able to find a lot of tutorials.

Corona; How do I create a database so that users can access it online using their android phones?

I am trying to make an game using corona sdk where a user can see what items he has and how much he has left. Its abit like a inventory management app. How do i go about doing this? I have no idea what to do and where to start. Currently what I found online is this:
-- open "data.db". If the file doesn't exist, it will be created
local path = system.pathForFile( "data.db", system.DocumentsDirectory )
local db = sqlite3.open( path )
This actually creates a local database which I don't want. I'm guessing instead of "system.DocumentsDirectory" I should put in something else? I referred online at corona labs (http://coronalabs.com/blog/2012/04/03/tutorial-database-access-in-corona/) but nothing really gave me what I needed.
Any help on this is welcomed. Thanks.
EDIT: I'm using SQLite if that's important. Also if anyone is not sure what I'm trying to ask, basically I'm trying to have a database stored online so that i can access it using my android device. How do i do that and what tools do I need?
You would have to make a REST API to manage online database and then use the HTTP requests to create, remove, update or delete records.
I would suggest to work on HTTP server which would provide you endpoints to interact with your database records then use Corona's network requests to communicate with the server. You can use the JSON format to easily exchange data over HTTP.
You can read more about network requests here.
If you want to know about REST APIs or database endpoints you can start reading about it here.
You can read about using JSON in Corona SDK here.

Online database for android app

Recently I'm developing an android app and I need to store large amount of data in pre-populated online database. How can i do it? and what is the easiest way to do this? can someone please help?
You have to make a Web service with some database either MySQL, MongoDB, etc ... and the application using HTTP requests to WebServices and attempt the data.
Here I leave a pretty good example:
how-to-connect-android-with-php-mysql
You will need the following:
JSONParser class.
Corresponding API.
API should reference to database properly
Android class should call API URL. (eg. http://example.com/yourapi.php)
Android class should send http request using parameters as required by the API.
For further details and startup, you can always go http://www.androidhive.info/2012/05/how-to-connect-android-with-php-mysql/. The best example to start with, though not that secure. :-)

Which database type is applicable to Android application for contents available in server?

I am trying to develop a real-time Android application where all contents are stored in server. So, they are available whenever a connection to Internet is available. Also, the application provides communication between users and conversations are stored in the server as well. Nothing is locally stored.
However, I am still cannot decide which database type I can use. I intended to use SQLite but I am not sure if I can really use it or not.
Could you please guide me to the proper database type to my application.
Appreciate your time and efforts.
As its upto you which database you use.
you may Install Lamp (For Linux) or WAMP(for window) . This is a nice database tool and very easy to handle and easy linked with PHP for various database function
I recently developed something similar to what you are talking about and here is what I would suggest you to go for.
Use SQL server to manage the data on your desktop and create a web-service in .Net on Visual Studio.
(Note that as others have already mentioned, it really does not matter what is the database you are using in your server end, because eventually the data is going to come to the Android application from the server in form of either xml or json in the web-service., regardless of what database you are using. So it is totally your wish which database you want to use.)
Then connect to the web-service in your application and set/get data from the remote Database, using SOAP.
Link on how to make a web-service in .NET (does not include the implementation in Android).
Links on how to connect your service with Android : this, this and this.

Database over internet

How can I make a database over internet, so I can update the database and all the devices that have the app will get that update to. Am I supposed to use mySQL database for that like in php? =) I have google'd and all that stuff but can't find a good answer.
I hope you know what I mean! Thanks! :)
(Sorry for bad english!)
first you have to decide where you want your data to be stored. You can store them locally on the device or on a server accessible through the Internet. I assume that you want them to be stored centrally through the Internet, in that case you can either connect to the database directly or through an interface. For most of my work I usually put up some scripts to handle HTTP-request (I like using the web technologies) on a server and connect toward this. If you make a PHP or other script you can call this by sending a request for either getting data or setting data.
Your question doesn't make sense. A database isn't inherently tied to the internet. Instead, you have a database on a machine, and provide an interface to it. One way to do this is to do something like write a Rails web interface using a REST based communication mechanism, and then have your apps interface with your database using HTTP requests. This is probably the most commonly done thing, and there are lots of libraries for things like rails, PHP, etc...

Categories

Resources