I am trying to create an Android app similar to google latitude and I am not sure what to use in terms of databases. I thought of using SQLite (which is serverless), but I still need a server in order to make two clients communicate to each other. I am really new with connecting an app with a server or a database, so any help would be appreciated.
I dont believe there is a way to remote connect to any database from Android (could be wrong, but when I check it wasnt possible). Your going to have to use SQLite for your local, and i recommend using MySQL for the server side, and use JSON to retrieve information via a service page.
OK, what you want to do is a client-server architecture. You need to think about what kind of data you want to store, and where to do that.
Obviously, on the server side, you need to store data. It will depends what your server is, and what technology you use for it. This question has nothing to do with Android, as you'll probably communicate to your server using HTTP or another protocol that would allow it to communicate to your android app (the client) and maybe later on, to different kind of clients (web app, iOS, etc.). So you can use any database technology, Oracle, MySQL, Postgres, whatever. You can even build your server application using Microsoft .NET technology, or anything else. You're not tied to Java / Android (although my personal technology stack of choice would probably be a Jetty HTTP server, Oracle database or MySQL if you want lighter, and Java of course).
On the client side, you may also want some data storage, and in this case it depends on the size and complexity of what you want to store. For simple key-value pairs, use SharedPreferences. For more complex data structures, SQLite is your technology of choice.
Related
I need to develop an Android app which is basically a geolocator, allowing people to reach each other via Google maps. All being said, I don't know how do I accomplish such thing since I don't know how it does work and if I need a server or database on the way. I'd be grateful if anyone could shed some light on this topic.
As you said you will need Android application and Server through which Android clients will communicate.
Android Application
will be getting data of other Android devices from server and then showing those data on the screen
will be periodically sending own location to the server
Server
is responsible for storing geolocation of Android clients, data can be stored in some database or memory of the server, depends on the use case, how long you need to have those data, how important they are, etc.
is responsible for sending stored geolocation data to Android clients
you have various options, you can write your own server in whatever technology you wish - it can be PHP server, NodeJS server, Java server... or you will use some serverless solution. Check for example
https://firebase.google.com
has to be hosted somewhere, you have many options:
there are "traditional" hosting providers, where you are usually limited by technologies you can use, for example you can just use PHP or you will use products from Heroku or Amazon AWS.. there is more, Microsoft has Microsoft Azure or Redhat has Openshift.. There are differences in prices, services, etc., it is up to you to look and decide what is the best for you.
I for sure missed lot of things. It is not in my power to describe every possible corner case because the question is too broad but rather provide you with higher overview of the problem and possibly point you where to go next. I suggest to you to read more about problematic and then get back with more specific issues to solve.
I'm new to Android, but I'm ultimately hoping to create a social networking app. I'm trying to figure out the best way to store user data (profile field responses, etc). I'm planning to use Google App Engine for data storage. Very generally, how do I take data gathered from, for example, an "Edit Profile" page and (a) store it in the GAE datastore and (b) make it show on the user's profile? For example, what methods would I use, and how would I set up user data? Also, I know there are more user-friendly interfaces for GAE datastore like Objectify and Slim3; can these be used with Android? I apologize if these are general questions, but it would be great if you could point me in the right direction!
GAE is a Server side platform while Android is a client side platform. Both of them while using Java as their base language have different SDKs. So you cannot mix them.
The approach that you will need to take is the following:
Build a simple REST Web Services layer for your Server side application that is hosted on GAE.
The Android client will make a REST call to send and get data from the Server.
On the Server side Java application that you host in App Engine, you can use the Datastore API. If you want to be a bit more productive you can look at libraries like Objectify.
On Android, I suggest that if you are going to store preferences/profile details for the user, you should use the following:
a) Use Android Preferences. This will save the preferences data on the device itself and will not need network calls to happen between the device and server just for the sake of getting preferences.
b) Any data that you really need to save on the Server, you should as mentioned earlier make a REST Web Server in GAE and invoke it via HTTP Networking on Android.
Hope this helps.
Basically my android project is around making a form to be filled up by the user of the app. And send this data to the php server. The data may be collected offline so the app should also save the datas unless its in the reach of wifi or gprs network. I'm early beginner to android and got stuck in between. Can any one suggest me a similar project sample so tat I could make a study and learn the stuff.
Sounds to me like a good use case for a hybrid client-server app. Use the mobile device to collect forms and store their results in a SQLite database. Whenever an appropriate wireless network is available, connect up with the server-based app and upload all the data. There are many good ways to do this, but for starters, consider making the server app implement a RESTful API and have the mobile device use this API to send in the data. If messing around with a server sounds like fun, I've had good luck with MySQL + CakePHP. One of the cool aspects of CakePHP is it gives you RESTful access to your database almost for free. Or, you can use something like Google App Engine and let someone else worry about administering the server.
I intend to write a multi platform smartphone app (currently only I-phone and android).
Which has to send and recieve information from a web server I intend to create.
The web server will do all the algorithms, and handles also DB connection.
My question, is how is this best accomplished, which kind of web-server technology fit best the scenario, and supports connections from various devices.
Basically, I thought about implementing a simple TCP/IP protocol, making the app (on the phone) the client, and server on the web on the other side. however, I want to deploy the application to an application server (maybe google app, JBOSS, etc.) and I don't want to be stopped by various firewalls.
does anyone has an idea ?
edit: few things are certain, the application server will be written in java, and db will be mysql.
This is a very broad question and any suggestion about which backend technology to use will depend on your language preferences, your other requirements, etc.
For starters, I'd suggest JSON over HTTP as a transport mechanism: it's easy to parse on both client and server-side, and it's directly usable in Javascript should the need arise. XML is another choice, but it can be annoying to parse.
JSON-over-HTTP (or XML) will be completely device agnostic and won't have the firewall/proxy problems you'll run into trying to do a custom-implemented TCP-based protocol.
For the backend, may folks use MySQL or Postgres for their database, and connect to it from Java, C#, Ruby, PHP, or other server-side languages. Use what you're comfortable with or what you want to learn next.
Why not write the server-side as a regular web application - in whatever technology you like (php, asp.net, java)? This way you can deploy the app on any web server and your client apps on the phones would simply establish a connection to an HTTP server. Normally, firewalls would not be a problem in such situation.
I have used this setup for my apps (both android and iphone) - connecting to a web server app written in php with postgres back-end.
I'm planning on constructing a large application. It will have a browser based interface along with a mobile application interface (iOS, Android, blackberry).
I would like to be able to push data from the server onto these interfaces, and there will be a lot of data being sent from the mobile apps back to the server. So my question is what kind of server am I looking to build.
I'm a PHP developer mainly, though I can write in Java and have dabbled in others. I'm fine with learning a new language. My thoughts as a PHP developer is that I could just build a PHP application and use it's API to power the other interfaces.
However there will be a lot of data moving around and I don't feel like PHP would be the best base for this really. So I'm exploring alternatives. Any thoughts on where to start with this?
you can use a framework like Rhomobile's Rhodes that generates your browser based clients and they also offer a server component: http://rhomobile.com/products/rhosync/
Common practice would be to separate out the backend functionality between different servers.
Server 1: serve up your static content
Server 2: serve up your dynamically generated content (things based on queries that require IO such as DB interaction
Server 3: dedicated realtime infrastructure for the realtime push functionality
Server 1 & 2 could probably be the same server for now but I'd recommend having a dedicated realtime server. Communication between servers is normally done with some sort of message queue although web service calls are also an option.
My area of interest is realtime push so here's a bit more information on that. If you want to stick with PHP there's the phpwebsocket project. If you want to look at Java then there's [WaterSpout}(http://www.spoutserver.com/), jwebsocket and Jetty which has been around for a while and is (or was the last time I checked) used by the Twitter Streaming API.
There are more options for the realtime component of your solution on this Realtime technologies guide which I'm maintaining.