Developing an android API backend with cloud endpoints in Android Studio - android

The background story: I have a nice client in a form of an android app, and now I want to create a backend that will use the Data Store service of google.
Now, I've created a simple backend module in android studio (SayHi example) which I've tested and works well.
My problem is how to proceed now. all the backend developing itself should happen in Android Studio or another environment? where do I create the backend classes and objects? how do I connect it to the data store service and perform queries?
Main question- how the backend creation process exactly goes, and once I'll connect the dots- where is the information on how to develop it (classes creation etc).
thanks!

You can do your development inside of Android Studio. Just have 2 seperate modules inside the same project; one for the android app and one for the backend.
You've integrated the sayHi example and you've said it works. Have you been able to call it from your app? If so, just look at the example, make sure you understand how it works and expand on it.
For you backend it would be best to use some sort of Service Layer - Business Layer - Data Layer design pattern. The endpoints themselves would be in the Service layer. The business layer will manipulate the inputs and outputs. And the Data Layer would be your connection to GAE. I personally use Objectify in combination with the datastore but you don't have to.

Related

Cross platform application

Me and my friend are going to work on final year project (graduation).
We are going to create an android application as well as web.
Now the problem is that we can not work together. He is far from me but we have to access a single database as android and web will get and post data to same data base.
Is is possible to create a single data base and both of us access that db?
If yes then how???
I am working on android and friend on Web
Thank you in advance
The main idea here is to create a core code, something you can share no matter what sort of application are you building web or mobile, that means you have to start creating an API, preferably using a programming language you handle with some framework for extra help and then setting up a DB engine.
There are plenty of options you could use, eg. db4free.net for MySQL, mlab.com for MongoDB, Amazon aws or even Google Cloud offers free accounts for testing purposes and once you have your DB and API built, you can start creating the client application.

Is there a way to deploy backend (Kotlin) server application to Firebase?

I have already written a backend server application, which executes rather complicated tasks in Kotlin and it is running fine on my local machine.
I looked into Firebase and found out that you could host your website and create your database. My server application is basically a database, plus everything to handle it. I think that it should be possible to write the same database with Firebase's database too, but I think that that would require quite some time and I would need to learn how to access the database from Android and also understand how the Firebase database works and how to implement my functionality.
Concluding
My question basically is, if it is possible to deploy my already written app to Firebase and access it like before. Maybe through the website hosting and a link to my Kotlin app. I could not really find any information on how to do something like this.
TLDR; No, this is not possible with Firebase, however there are alternatives.
Firebase is a Backend as a Service, this means, that they basically provide most functionality for you. The Database can be directly accessed from the client application (an android app for example), or a third party server. The website hosting is static, meaning you can't perform server side code, and instead only serve your pre-built Html/Css/Javascript.
They have recently introduced Cloud functions, which are basically small functions executed on their servers, which could fulfill your purpose, however those are currently only available in javascript, and probably have a vastly different architecture from your existing backend, due to their nature of being small functions.
If you don't want to rewrite everything to work with Firebase, I'd recommend going with a service like Heroku, which is a Platform as a Service. This means that you can deploy your existing Kotlin backend to Heroku, and use that as the backend for your app.

A good Android and Web Services structure

Suppose I have to make the following things:
An Android app that must send informations periodically to a database (without the interaction of the user)
Moreover, this android app, must provide various services to the user (user interaction)
Also, i want to provide a web interaction to the user, and for it i would like to use Vaadin
I use MySQL for the database
Is it correct to have this structure?
Android <--> PHP <--> MySQL Database (using XAMPP)
Vaadin (web side) <--> JDBC <--> MySQL Database (the same database as above)
Its not incorrect but you are creating double work. You are creating web services in PHP to service the android client call this API1 then you are creating a Vaadin based web site which also acts as an API call it API2.
Two API's in different frameworks to maintain which is just adding more maintenance and complexity. If the web site mimics the android application you will essentially be duplicating the code.
Or if you want that in pictures:
Create a web-services API that will be used by Vaadin and the Android application. This will eliminate the double work. If you create the Web-services using REST or SOAP you will be able to reuse those services across both front end application. Now when you grow the application i.e. you want to add iPhone you can simply consume the same services.
Or in pictures:
Hope that makes sense.

Communication between website and android app

I want to build a website, where the data will be saved in a data base, logical in a sql database. Also, I want to build an android app, which will take the data from the above (sql) data base. How can I achieve it? I mean how can I manage the communication between the website and the android app. In past, I have create website with php and sql and also I have build android apps, but now I want to achieve the communication between them. Can I use parse platform?
FYI, without any server communication you can't use the website database in android application.
If you want to manage the communication between the website and the android app means you need a centralized server which having the data of your web/mobile applications. So, after that by using the web service methods (REST/SOAP) you can achieve the communication between them.
yeah unfortunately chrome won't let webapps use local storage on android. what you can do is create a local server (using org.apache.http package for example), let it run as a background android service, then have the website make requests to that url. Its considered hacky, but it would work. You can post whatever data you wanted the website to know about , and then get it from the website.

Android - Rails communication

Given the lack of information on the web ask a question:
I'm going to create an application in Android, the use of a database application
Rails. For this I need a manual session. So if anyone has a ready
example / tutorial showing communication android-rails using
session, or is able to share your knowledge on this subject?
Rails 3 resources use RESTful APIs by default. Define a supported format (XML or JSON) in your Rails app and just make REST calls from your Android client.
There should be no need for you to be trying to manipulate the database directly from your Android client. That will skip all the validations and before_saves you have set up in your Rails app.
Use REST and you should be fine.

Categories

Resources