Android App Engine with Cloud SQL or Datastore - android

I am new here and new to programming mobile applications for Android.
I am trying to build an app that has its user's log in info, and some other info stored in the cloud. The data will not be shared between client apps, but I need it to be available for a main computer to access it, if necessary.
I was wondering which service will be simpler to implement and use in this case: Cloud SQL or the Datastore API?
I read this thread (Deploying database on google cloud storage in Android application) and it was very helpful, but regarding my problem specifically, which service would be better?
My first though was that cloud SQL would be a better fit (but please tell me if I am wrong).
So I searched a little bit more about the service (https://developers.google.com/appengine/docs/java/cloud-sql/) and found the following sentence "An App Engine application must be in the same region (either EU or US) as a Google Cloud SQL instance to be authorized to access that Google Cloud SQL instance.". I think I don't fully understand how I can choose my App Engine Application region, but I am in South America, would that be a problem? I know that probably by default the cloud SQL will be in US... This thread is related to this topic: Using Google Cloud SQL with App Engine
Thank you very much for the help!

I don't think it really matters wheather you choose cloud sql or data store for simple user metadata management. Just bear in mind that app engine data store is no-SQL (think Cassandra) and CloudSQL is more or less managed MySQL service.
If you need to access the data from completely outside your app, CloudSQL would make more sense since all you need is access to the CloudSQL instance. If you do not need to access from outside the app (and you don't need your db to be ACID), then app engine datastore is advisable since it makes models and data handling more straight forward.
As for regions, if you start an app and you are a premiere customer ($$$$) you can choose to deploy the app in EU or US. If you're not a premiere customer, your app, by default, will be deployed in US servers. So, if you do decide to go the CloudSQL route, spin your instances in the US region, which is the default anyway.

Related

Why or when does an app need a server?

I have been searching for a proper answer to this question, have a bit of background in front end development, but with new concepts like SaaS, PaaS, etc. want to get information from experts out there, that could help any newbie to understand what it's all about.
Say I am trying to develop eBay like an app that takes a product from a user and sells it back to the other user who needs it.
Will my app need a backend server? If so why? I am already uploading my app to Google Play Store or Apple Store.
How will the backend server like HEROKU or FIREBASE or AWS help my app?
Can I implement two different services in single app, say for eg., firebase for backend database and HEROKU for payment processing?
Thanks again for your time and information.
SaaS
Answer: SaaS stands for "Software as a Service". In layman's terms, someone developed some software and hosted it somewhere. You can use that hosted software in your software project/product as a third party service (like public API); or directly use that as individual software under some license like Firebase as mentioned.
PaaS
Answer PaaS stands for "Platform as a Service". In layman's terms, someone configured some hardware and exposed the hardware controls via some web based application or REST APIs. You can use that hardware to deploy/run/manage your application without having the actual hardware on premises.
Backend Server
Answer First of all, let me explain the server. The server is a middle-man who serves whatever is requested of it, and all browsers/mobile apps act as client. So for example, the web is all about client-server communication.
So taking the example you mentioned, an eBay-like app takes a product from a user (client action) and puts it on the server (client requests in background for server to put product on server). Then another user opens the app (client action) and searches for the product (mobile client requests server to return that product, if valid and matching search criteria), and then he can buy it (mobile client will request server to complete the purchase).
You have to understand that for any communication between web application, mobile application or desktop application, there will always be a server. Even in file sharing applications like shareit, one mobile app works as server and same mobile app elsewhere works as client.
Yes, backend servers like Heroku or Firebase or AWS will help your app to complete your application business flow.
Yes, you can implement two different services in single app, say for example, Firebase for backend database and Heroku for payment processing or hosting your application/APIs.
Unless you are experienced with building distributed applications that can persist data across multiple nodes in a consistent manner, and ensure data available, I'd say you most definitely need some kind of backend. Unless of course you only plan to have user-to-user transactions, that can rely on direct messaging between client applications - which seems pretty pointless and quite far from the requirements of an EBAY-like product.
In terms of the architecture, you can follow many different approaches, but in most of them you will require some sort of data access layer. I'd recommend looking into the three-tier software design pattern (https://en.wikipedia.org/wiki/Multitier_architecture) to better understand the way this type of software product is typically designed.
After sorting out which type of data persistence you prefer, you'll need to setup the backend where your mobile app will connect to retrieve the data from (things like products being sold, user profiles and ratings, your own history). Of course you could also connect directly to the database from the app, but that would be a big mistake - it would meaning making the DB access publicly available, and thus exposed to attack, not to mention that you would be hard-pressed to find a solution for user registration and authentication, which would have to be provided by other means anyway. Typically your backend will also manage user registration and authorisation.
Heroku, Firebase and AWS are all very different, each with their strengths and weaknesses, but there's nothing like trying them out to see what fits best. What you refer to as "Google Server" and "Apple Server" sounds like a misconception, and you probably mean the Google Play Store and the Apple Store. These are not applicational servers that you can use as a backend, and serve only as a repository for your mobile app from where users can download it, and nothing else.
Without some sort of backend mechanism, the challenge of making data available for the consumption of multiple users would be overwhelming.
I know this isn't a very specific answer, but your question is quite broad-reaching, and it seems you need to look into some basic fundaments of software engineering before going into more detail.

Android app, how to store information to internet and other people can see?

I've done Android development before (junior level obviously), now trying something different.
I just want to know how to store information to internet and other people can see? I guess it is not SQLite etc, please point me a right direction so I could follow.
I mean it is an app, whoever has it on his phone can input some information and other people who have downloaded and installed it can see the information submitted.
For a website, obviously the host will provide the storage but how about an Android app?
Thanks!
A client/server architecture is what you're looking for.
In order to have unique information reachable by all users, you have to provide a web-service linked to a database on your server that the client app (the android app) will query via the Internet.
There are many ways to implement such architecture, but I would recommend you to learn about REST web services, Java EE, etc...
After your last edit, I see your point. (Before that it wasn't clear what you were asking exactly)
For storing information -- that can be on file, database, webpage, etc. -- you obviously need a place to store your data. You're right. With website hosting you mostly get a database with it and that can be used to store information. That is the same with an android (or any native app). If your host is providing a database or cloud storage seperately, you may choose that option. In order to use that place, you should setup your host's server's IP address in order to reach it over the internet. In order to reach your database remotely, you can use your platforms native tools.
But if you want to create multiple clients (like client apps for ios, android, windows, windows phone, etc...) you need to create a Restful API to serve your data and that API should be hosted in the cloud. Then your native applications can use this Restful API you created and get the data from your database through it. That API will be the bridge between you native apps and database and you can configure your data manipulations and security (Access Tokens using Bearer Token Headers) on that API.
Does that answer your question?
P.S. Sorry if I offended you with my comments, but it's not the duty of moderators to warn and improve first messages of new comers. When you take a look at the Help Section, you will see what I mean.

how to work multiusers on one database

i am creating simple android apps like student registration.
suppose i registered three students data in mobile.(insert data).
then how all teachers can see student list. all teachers have same application install.
Thanks.
It is common for applications to offer features such as backup storage, data sync, data sharing etc. Building stand alone applications that only function and save their data on the device they are installed on is at times not feasible. A backend is usually needed where data can be saved and manipulated for the app to provide the service it was intended for.
Building this requires time, a different skill set and other resources (e.g. servers, push notification services, etc). Fortunately, there are several platforms that provide ready-made customizable backends that you can integrate with your apps. These are known as ‘Backend as a Service’, or BaaS in short.
we are going to look at using Parse to provide a backend for an Android application. We’ll briefly look at what it offers before building an application that will use it for user registration, authentication and storing of user data.
you can follow this link to learn more :
http://www.sitepoint.com/creating-cloud-backend-android-app-using-parse/
or You can see :
http://blog.parse.com/2014/04/30/take-your-app-offline-with-parse-local-datastore/

Syncing SQLite table over devices

Is it possible that I store my SQLite table over a dropbox account and have all my users sync their tables with the stored table? Also be able to make changes to that table?
Your approach could work in theory, but there are so many issues involved, that you're better off not doing it. If you wish to store and make data available across all devices belonging to a user, I strongly recommend looking into Datastore API by Dropbox. The API will take care of storing data locally as well as synchronize it over connected Dropbox accounts.
If you want a bit modular approach, you can use Windows Azure Mobile Services. These give you REST APIs to store your data in cloud. However, synchronization has to be handled by the developer - you. I have written a small library to do that here: http://bit.ly/ProjectMirror It's for Windows Phone, but Android version is already in a sister repo there. You could extend it. Let us know how that goes.
In addition to these services, Parse SDK is a good option. It requires you to pay after a while, though. In addition to what you want to do, it also provides other things like user management and so on. But, be aware that some of those operations may require you a live Internet connection.
So, in essence, if you want seamless data storage and sync, use Datastore. Be aware that you'll have no control over the server side. Also, your data will be restricted to the Dropbox ecosystem forever. If you plan on further expanding your app to other platforms, go with Azure and handle the sync. If you want lots of features, go with the Parse.
I would suggest looking into Google Play Game Services using the Cloud Save feature. Even if you are not building a game this feature lets you sync sqlite data in the cloud and Google will handle most of the work for you.
OR you could use a cloud based database which supports both push and pull. That means:
Scenario 1:
Your users change something on their phones. Changes are uploaded to the database. The database then pushes these changes to all other users.
Scenario 2:
Your users change something and upload this to the database. But instead of the cloud based server pushing the changes to all users, the users phones can ask the database for new data at intervals.
All this is very easy to set up. It took me about five, ten minutes. Just follow this easy tutorial:
https://parse.com/docs/android_guide
and for push:
https://parse.com/tutorials/android-push-notifications
We now use this for our company app, storing statistics for example.
Bear in mind that syncing can become complex. Try to keep it very simple, especially if you are new at programming.

Mobile Development and Cloud Database, Where Should I Start?

I am an Android Developer and a noob when it comes to web technologies.
I am planning to create an Android app that stores its data to a database.
I do not want to maintain my own server so I guess I would be resorting to Cloud Services.
The thing is I do not know where to start.
What do I need to be able to access and store data to a cloud database from my Android app?
Where can I get a cloud database preferably for free.
Do I need to use web services?
Any help
There are a few things in this that make me ask questions, as opposed to answer them.
Do you mean for your application to be always able to communicate with the database, or will it be more of a backup/sync with a database you have on your handheld.
If you do intended the app to be live all the time, then just write a web app and construct it with small screens in mind. It would be faster and sort of cross platform.
If you intend to have the app just sync with a back-end.. Well then a simple web service should do you for storage. Yep. Rails would be the way to go.
It really depends on your users.. How will they be using the app? Where will they be?
Personally I like the stand alone application that just sync's with the back-end. It is less prone to crashing because I walked into a tunnel. It also lets me control when and where I am when I sync. But it means the data I'm looking at could be out of date. And the data I'm adding isn't right there for others to consume.. they have to wait for me to sync'.
Check out Amazon's AWS and their SDK for Android. Highly recommended.
I assume that you know Java and my solution would be GWT/GAE ,since you asked for web application,GWT https://developers.google.com/web-toolkit/ would be perfect way and also you could use Google AppEngine Store as Cloud service and also you can integrate GWT with Phonegap to run it in Android.

Categories

Resources