I am trying to push some sensor data from android onto the cloud. There seems to be certain existing sites like xively, thingsspeak,nimbits which do all of this. But the thing is I need to be able to dynamically create new devices without logging into the site and also push data from the android phone to those sites. I can do the latter easily but the former seems to be an area where there is a lot of restriction. I also need to describe my sensor data very accurately so I would probably need several extra fields. Taking all this into consideration I have come to the conclusion that creating my own database would probably be the best way to proceed. However I would like to know if this option is the right way to proceed?
Also are there any easy to use libraries which help me contact an external sql database easily in android?
Yes, you should probably have your own backend for something like this. Google App Engine has a feature called Cloud Endpoints that makes it easy to write an Android backend and auto-generate an Android code for communicating with it. And it automatically handles the serialization/deserialization, so that you don't need to parse/serialize XML or JSON in order to send the data.
Related
I am new to Elasticsearch. I want to store documents of products details. Now I am using Mongodb as my database and nodejs server. But Mongodb does not have good search functionalities like Elasticsearch.
So I am thinking of shifting to ES. But I have few doubts as stated below please suggest me what should I do. Any suggestion will be appreciated.
Should I use MongoDb as my primary database for storing documents and ES as secondary database just for doing efficient search. Or Should I make ES as my only database for storing documents and searching.
Does using both will be good for future or it will make thing difficult to manage. I have also read that ES in not a good choice for main database as it sometimes loses write operation.
Should I make a server in nodejs to perform ES operations for doing any complex search or GET, PUT using rest api or should I do it directly implement it in java .
(Note I am making a android app so should I use TransportClient and Interact with Elasticsearch directly or I should first send a GET request from android side to my server and my nodejs server will interact with ES and send response to my android app).
Other than search part is ES performs as good as MondoDb in terms of Database.
Thanks in advance.
I am risking an opinionated answer here. However I'll try to help you out:
I am using elasticsearch as a primary data store in cases the data is not that important or just to big to have it duplicated. If you have things like logs you could also keep the original logs files around. By default I would say, use a different database as primary store, that way you can always rebuild elastic if you want to make changes to your search index.
Adding components to your infrastructure makes it more work to manage. So adding MongoDB as well as Elastic does mean more moving parts. However, it also gives you more flexibility. I would not be to much afraid unless what you are searching for is very basic and can be done with MongoDB as well.
I advice to always have an application in front of your search engine. Treat it like a database, you would not expose that to the world.
I would not use a Transport Client in your Android app. That would mean a security risk. You want to make a connection to your backend as mentioned in 3 and let that application connect to your search cluster.
Hope that helps
Simple example what I am trying to do.
I want to have database with one variable. I want to increase value of this variable from my android device.
Lets say I have button in my android application. When I click on it I want increase value of variable in database by let's say one.
I was considering using Google Cloud SQL Storage but I think there should be easier way to do that.
Have anyone faced problem like this?
What is the best solution for this problem?
As mentioned, Firebase is a good solution. There is also Google Cloud Datastore, which is somewhat more unwieldy than Firebase.
On a related note, if having a full app back-end seems overkill you might want to take a look at the alpha preview of Google Cloud Functions, which are cloud-hosted Javascript functions you can invoke with a simple HTTP trigger.
I've come across this problem when thinking about creating different apps for Android. I see these apps that show you the weather cast or sport results, and I wonder which is the source they get all data from.
I assume they don't have their own database which they fill with data manually and live. I suppose they use some kind of web service, data source or something like that. I don't know if web service is the correct term to use in this case (english is not even my native language).
So I would like to know the correct term for what I'm looking for, plus any guidance on finding this kind of services, in order to be able to develop apps using this kind of data sources.
I think this question will help many programming students like me.
It depends what you trying to develope- Some apps use simple GET/POST Requests and get it's data back formatted as JSON or XML (which is the common case).
Some uses SOAP for getting their data.
In some cases they are using plain Sockets or CouchDB.
In some cases they are using Push Mechanism (specially for android) like GCM to send their data to the client.
It always depends what you want to do.
I want to make an app for android that updates via the internet so the information in the app is always current. What is the best way to implement this?
I understand I will need the information stored somewhere?
And I will need to be able to access it and read it into the app?
I am not looking for specific code so much as a general way this could be implemented.
As an example think of a weather app that must pull weather data from an online source.
Thanks
In general you could achieve what you want in one of the following ways (both are popular methods and used in many apps):
Implement a web service layer to pull the data from the server back to your application. In Android, this is normally done via JSON based REST API. JSON is used nowadays as the data is regarded more compact that XML and it's easier to deal and manipulate in Android.
Note that it's common to implement caching in phone local storage if the data is not updated frequently.
Most of the time, the authoritative data is stored in the server
With this method, you could arrange the layout freely on your app. However, you need to write Java code to arrange the layout
You could also add better interactivity especially if you are thinking that your UI will have a lot of touch interfaces or animation
Other way you could do this is by developing a mobile HTML webpage that you could embed in Android via Webview. A simple tutorial is available on Android's website
This method will retrieve HTML from the server, the same way your desktop browser retrieves HTML. The only difference is that the HTML is mobile optimized. Good example of mobile optimized HTML is gMail from Google
Using this method, unless you have full control of the server side, you don't necessary can control the layout as the server is the one that generates the HTML
A lot of times that interactivity is reduced with this approach though Javascript framework such as Sencha and others are quickly reducing the interactivity gap between native code (#1) and using HTML
Could someone please point me in the right direction. My project involves a database where users enter their address and other info from my website. This database is then referenced in my android application to show the locations of these addresses in my database.
I have yet to start and just came up with this idea. My question is, what would be the best method to create a database easily modified through my website (mySQL, php, etc), and also easily referenced easily through Android and the Google Maps API? I need some ideas on the languages I will need to use to create this database and website so I can go buy the necessary books to start reading up.
Thanks so much
I believe the best way for you to go with this one is:
a database cache on the device
that means you can use XML if you don't have many complicated requirements from storing the address
or SQLite if you want to be able to query the database and do more fancy things
on the server side
if you only need to get the data from your server on the device, then a simple XML with a unique address per user should do it
if you need to push addresses from your device to the server then a REST system needs to be implemented
So, now you just need to figure out exactly what you need from your system and then start googleing on one of the solutions I gave you! Good luck! :)
Google App Engine would probably work for that. GAE supports Java and Python. Maybe use the Restlet framework (compatible with GAE) to implement a REST architecture.