I know this is a nooby question and I apologise in advance. I'm looking all over but I just can't seem to find any documentation on connecting an Android app built in Android Studio to a Google Cloud SQL Database.
I'm only really doing this to try and find out how it is done because I'm interested in it but I'm very new to Android development. I've connected to a SQL database before from c# but it was only a local one, I've never connected to an online one before and I think the Google Cloud Platform operates a bit differently anyway?
Basically, whenever I try to find documentation for this, it keeps referring back to the Google App Engine, which seems to be a different way to create apps than just writing them in Android Studio (very likely I could be wrong, like I said, I'm very new to Android development).
I've seen that there is documentation for Eclipse with the Google Plugin but can't find anything for Android Studio. Is Android Studio not suited for this type of use?
I've seen that you can create a Google Cloud module for a project in Android Studio but I'm not exactly sure what that entails.
Basically, I would just love a set of very basic steps that I should follow for if I were wanting to write to a Google Cloud SQL DB from an Android app in Android Studio.
Otherwise, any good resources where I could possibly learn more about what I need to do would also be appreciated.
I think my biggest issue currently is that I have exactly 0 backend knowledge and so I'm just not really sure of what is required to set up this connection.
You should not access Cloud SQL directly from your Android (or iOS) or other client because you cannot secure the credentials needed to do so. If you embedded your credentials into your app, someone could extract them and either gain access to your database directly or could cause other trouble for you.
If you are open to other database types and you don't want to explore proxying requests through your own backend, then you should take a look at Cloud Firestore or Firebase Realtime Database. Firebase provides SDKs for Android that allow you to access these securely directly from your app. Firestore will scale better than the Realtime database, but that might not matter for your app.
A similar question and reason for why you shouldn't try to connect directly to Cloud SQL is covered in more depth here.
Related
I have been trying to learn how to create an app that allows people to upload images via the web or android.
I know that Android uses content providers to implement a mechanism for the sharing of data between applications. More specifically, Android uses the MediaStore API to make use of this functionality. However, that is limited to other Android devices.
I was wondering how I would go about connecting a web app made using reactjs to an Android app preferably using firebase. However, if it isn't possible in firebase that would be okay too,
I am a beginner in web app development, so I am not particularly sure about how the software's architecture will look like.
I have been struggling to find an updated concise solution online. Can anyone point me in the right direction and if not point me to some resources that will guide me in the right direction.
Thank you!
Attach/configure both of your application to use same database and storage bucket in firebase
As you can see I connected my android application as well as web administration application to same firebase project.
As you can see there is an add app option in firebase console where you can select platform. Register both of your application on same project and thats it.
I am doing a project which requires me to query google cloud mysql database to save, delete, retrieve and update data using app build in android studio.
I have been googling for quite some time, all the tutorials are using AppEngine. However in android studio 3.0+, there isn't any App Engine available anymore.
Please give advice / guidance on what should I do?
thanks in advance
Since Android Studio 3 doesn't support AppEngine anymore, you have two options:
Build your own custom backend (web service) to function as a layer that allows database consumption via the Android app. This will require more development effort than option 2.
Set up Firebase and use its database instead.
You will have to do a bit of research on getting Firebase up and running, but you wan't have to build a custom backend.
If using the Google Cloud MySQL database is a must, then you can't get around to foreseeing your own backend layer.
I've been reading through developers.google for a few days now and this process is still confusing me.
As far as I can tell, I need the following:
An Android application
A Java App-Engine backend that uses Endpoints (still not quite
understanding what these are).
Code within this backend that connects to my Cloud SQL instance.
My problem is that none of Google's examples seem to have an Android/Cloud-SQL example.
I've been using this guide on how to create an Android app with App Engine backend. But then it uses Google datastore stuff, I think? I need to use SQL rather than this.
In this guide there is mention of App Engine, but for a JSP web form front-end, and no mention of Endpoints.
So my questions boils down to, have I got the right idea with using EndPoints + Cloud SQL, and if yes, how does one achieve this? I'm quite a JDBC newbie in general, so I'm not quite sure how to achieve this off the top of my head.
you are on the right track.
Just for the record, if you don't have strong reasons (yet) to go for a SQL data store, do consider using Google Data Store as it is better seamlessly integrated into the SDKs and after a couple of compromises it should help you pushing your data design to scale nicer.
Let's split it into parts:
First you have your backend/api. This is basically your piece of code that operates on Google servers, which you'll access on an remote connection basis (http, socket, etc) - (same as most of the APIs we know work). I don't know which programming language you are using but here is some basic set up for your project and Cloud SQL on Python.
Cloud Endpoints is nothing more than a very cool feature that App Engine brought recently to avoid all the mess of creating and updating your client libs over and over again. It basically automates that task for you, by using annotations or references you put in your backend code to create client libraries for Java, Objective-C and JavaScript that you can then integrate into your clients.
Example: Let's say I have a controller on my api to operate with bananas, that has a method to delete a banana from the api. Annotating that method on your api code, will let endpoints script know that this methods is there to delete bananas, thus it'll gather it and include it in the generated clients libraries, so that you don't have to do that manually for any of your clients, nor every time you update you api code. [Here's] some documentation.
Android Application. That's certainly your business :) But I'm sure having your api libs already generated already helps a lot.
Hope it helps. Let me know if you need to get more into detail.
I know this might seem like a basic question but can an android app which i know uses SQLite work with a web site like http://www.freemysql.net/client/. I have developed a desktop program in netbeans that functions with this website using MYSQL and I want my android app to upload information to this site as well. Or can i use MYSQL with android. I just need to be pointed in the right direction. Any help will be greatly appreciated
If you only expect your app to work if "online" you may be able to make it work. I would expect that the cloud db API already qualifies as a web service interface like Kevin mentioned you would need. If you want a desktop and Android app to use this same database, it seems vaguely reasonable.
I didn't see any API documentation for the site you mentioned. I would focus your attention on how to write an Android app that communicates with a web service. Since you've already written a Java desktop client, you probably already have some idea about this.
If you decide at some point you need access to a database "offline" you should just look at a tutorial for database access on Android. It's not that painful. You may want this so you can store data locally and push to the cloud when you're connected.
http://developer.android.com/guide/topics/data/data-storage.html#db
I know my question eventually won't match the title I opted for the question, but I honestly didn't know how to put it as I'm new to the Android and PhoneGap environments. If this is not a programming related question please accept my apologies.
We have got a .NET application that sends TASKS to our mobile employees' netbooks via webservice. The mobile users have got a local database that gets updated with new TASKS once they login. When the TASKS are completed, the local database gets updated. If there is a stable internet connection the update is then sent to the remote database.
Now we are planning to do both Android and iPhone version of the application. I understand this is possible using PhoneGap and HTML-CSS-JavaScript, but don't know how to go about it.
If anyone has experience of implementing these sort of applications, please guide me to some links/articles. I did some search on Google but didn't get a precise answer.
Thank You.
The getting started guides are all here. Each platform requires some amount of setup because of platform-specific SDK's and so forth you must download, so I would suggest starting with iOS if you have an iPhone or Android if you have an Android phone and then once you're up and running making the switch to developing for both simultaneously.
As for the question about a SQLite database, PhoneGap should be able to do what you describe. The documents for local storage, once you get to that point, are here.