Creating dynamic database to which I can send data from android device - android

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.

Related

What is best way to using Elastic search for searching (Via Server vs Direct Java Client)?

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

How to make an android app work in offline mode in android

I want to know how i can make my app work in offline mode and store the data on a local database on the android device.
I am using mongodb database and fetching the data by using JSON Parsing.
What should i use to make my app run in offline mode and also update the changes made on the server ?
Which tools should i use ,also which is the best and easy method to implement this?
Thanks in advance.
first you create local SQLite Date Base
in that create one extra column like "noNet" ...
In this column you save your data when phone in offline mode and then send data to web server when phone is online
This question is a bit older now, but I'd like to add what I believe is a good architecture approach to solving this.
Take a look at the tech talk given by Yigit and Adam at the Android Dev summit. https://plus.google.com/+AndroidDevelopers/posts/3C4GPowmWLb
Seems the core components are:
Job Scheduler/Queue, via https://github.com/yigit/android-priority-jobqueue
DBFlow to make interaction with the SQLite database easier: https://github.com/Raizlabs/DBFlow
And an EventBus https://github.com/greenrobot/EventBus to easily broadcast when the actual jobs complete (so the UI and other components can be notified).
Those 3 together get you most of what you will probably need. Their tech talk (first link above) really details these things better, and there's a final example application you can take a look at as well: https://github.com/yigit/dev-summit-architecture-demo
If you have an option, you can go for couchdb or couchbase which provide couchlite for android and sync is taken care by itself.
you can also refer this thread here SQLite on Android and MongoDB with synchronization

Pushing data into the cloud with android

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.

Android App with SQL server

I have a few questions regarding sql server in android.
Essentially, I am tring to create an app that communicates to a SQL server, runs queries, creates new tables, rows, etc. I have been doing a lot of research recently about getting a connection to a SQL server in android. I've seen the tutorial on using a php file and it seems that isn't quite what I am looking for.
My questions:
Is it possible to create an app like the one I described above?
Do I need to do it using a php file? (like the tutorials)
Is there another way to do what I am looking to do?
Should I create a webservice to do the database portion of it? If so, are there any tutorials out there about that?
I apologize for my noob-y questions. Thanks for your help
You should definitely create a webservice, because otherwise any malicious user who has access to your app (downloads it) could easily trash your DB. But allowing insertion and creation privileges to users seems like a bad idea already.
If your users need a personal db, why don't you use sqlite which is stored locally and has no access delays, and no internet connection requirements? Why do you want a single db that is completely exposed to everyone?
It is not a good idea to communicate directly to SQL server from Android Phones. You might hit so many technical constraints when you keep going with the development. I am not sure about he end result as well. It would be great to go ahead with the service that way you might have lot of controls inside the application and design it efficiently... Just a thoughts :)

Whats the best solution for a database used in conjunction with Maps in Android?

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.

Categories

Resources