Connecting iOS, Android, and Rails App to One Database - android

My friends and I are developing a rails app (ruby), iOS app (swift), and android app (java). We are trying to figure out the best way to connect them all.
From our current research, we are under the impression that an API will need to be created with rails and the mobile apps will then have to communicate with that. Is this the only solution? I am also understand that apps can "pull" data from an api, but what about the other way around? We would like each application to be congruent with each other... for example, a record is created in the iOS app. As soon as this happens, the record should also be able to found on the rails app.
When thinking about it, it seems like all we would need is one database, and then have all of the apps connected to it. Would something like this work?
Having trouble finding solid information regarding this. If you know of any documentation, please pass it my way.

The best way is to host database in cloud and access to that common database from all applications. If you host your database with any hosting provider, they will give you a connection string using which you can access from any application. See Amazon AWS for example.

As I understand it, the popular way to interface with your database would be to expose it through a REST framework. Doing this, it doesn't matter how many apps you want to be able to interact with the data, or what platform they are on.
Also, check out Kivy as an option for your mobile implementation, as it allows you to deploy to iOS and Android from a single code base. Of course, you may need to account for differences in hardware APIs, etc... But that would be easier, IMO, than maintaining multiple code bases.

Related

How can i build native android apps from any website (Not Website convert into apps)

Suppose , i have a website and its running well . Now i want to make an android apps using website information or My apps will contain all the information of that website already contain or how can i connect an android apps with any website.
Some solution :
1. convert website into android apps (i don't need this).
2. JSON API (i think this is best option for me ).
May be there has so many option but this time i can't remember. option is best for me if it is possible . but i don't how to create a JSON API from website .
but i don't know how to do it. please let me know share something for better understand.
or if has any other better solution for this problem please let me know .
You could create a web app, using android native web view or some technologies like ionic, etc..., or create a comprehensive API endpoint in your backend/website and start build an android app from scratch.
creating a web app is a simpler approach but has so many shortcomings in design, functioning and flexibility aspect, so if you want a competitive app with a fine extendibility feature the best option is native android development. but it could be more costly as it needs both backend and android development.
If your website is already implemented and running, you can just create an Application using a https://developer.android.com/reference/android/webkit/WebView. Basically, this is an injected Browser, allowing the user to access your Website without actually open chrome/firefox etc. on the smartphone.
To improve the usability, the layout of your website should be able to dynamically resize the content.
If you wish to actually implement an application (Activities/Fragmets...) you need to connect to your backend server the same way your website is retrieving the information.

How to make the server backend of a mobile app?

I am an Android developer and I want to make an app which shows users on a map and performs tasks based on their location.
The whole model of the app has to run in the server. I need an API which:
Receives user location
Performs calculations based on the location of the users
Sends response to specific users with the results
The problem is that I have 0 experience in doing server side programming.
Can you please suggest me a way of making the server?
I checked the Google Colud Platform and this video. The video addresses the connection between the app and the server, but what I really need is coding the model and deploying it on the cloud.
What is the way for me to build the API for such an app, as a developer with no server side programming experience?
Can you suggest me a tutorial which goes trough the process of building a cloud backend for a mobile app?
This is a very complex question. I don't recommend using a "ready-made" solution like FireBase because it's even harder to transform it into a "proper" API later on when you need it. If you know Android then you know Java, you'll have no problem learning working with a framework like Spring Framework which I recommend. Java on the backend needs a Java Servlet container, like Tomcat. First you should set up a development environment on your machine for this. I recommend searching for Spring Framework tutorials for this i.e. Spring Framework REST tutorials.
Secondly you'll need a database like MySql or MongoDB to store data. Spring comes with ready made connections to most of the most common databases, so its pretty easy to work with them.
When you're ready to deploy your service I recommend using a PAAS like Heroku.com where you can run your service for free first. In this way you get to control everything yourself and you also learn a useful skill.
Since you are coming from the JAVA background you just need some basic building blocks and you shall be good to go.
Use PASS: They will take any devops from your side which will be a big relief considering you are not familiar with anything on server side. I recommend using Heroku or App Engine. Here's guide to App Engine with JAVA on top. https://cloud.google.com/appengine/docs/java/
Database: Not sure how you are storing and managing your user data as of now, but if you need database, there are various of those available now. The reason Firebase is top suggestion, cause it leverages realtime and gives you control on your side without spending a lot of time on your side.
APIs: You will be taking user's geo-location and sending it to server. On server you will need to process that into a real world location and any other logic. You will need to use Google's GeoLocation and reverse geocoding APIs for that. Find apis here : https://console.cloud.google.com/apis/
Also if it's any help, App Engine and Heroku both offer free limits and should be pretty sufficient for your use case.
Since you have limited experience on server side development I'd suggest using a backend-as-a-service platform. This approach has the benefits of allowing you to focus your time coding the client where your competitive differentiators are, and lets you leverage years of experience in server-side development without having to ramp up on the technology. It also means you can iterate quickly and test features ideas with less risk.
There are several options out there, but in your case, you'll need something that provides enough flexibility to implement custom logic and a custom data model. Some platforms allow you to create a full backend application with REST api endpoints, and automatically take care of deployment, security and management. Some examples of backend service providers can be found here https://en.wikipedia.org/wiki/Mobile_backend_as_a_service.
Some of the platforms actually allow you to build a full custom app without actually writing any code, and some of them provide ready-made components (like chat, leaderboards etc) but are less flexible.
Here's a list of Backend-as-a-service providers:
https://quickblox.com/
https://www.appcelerator.com/
http://www.configure.it/
https://cloudboost.io/
http://api.shephertz.com/
https://backendless.com/
http://pipegears.com (No coding required)
You didn't provide specific details about the tasks you want to implement on the backend, but it's likely that you could satisfy your requirements with a straightforward REST api that accepts your location data, runs business logic, reads or writes from your data model and returns whatever data your client needs. (Sorry I can't get more specific without details on your requirements). If you're dealing in sensitive information like location data, I'd strongly recommend securing the api with TLS/SSL (i.e. https), or make sure the platform you use provides this.

Trying to setup an SQL database and access it from an Android App

I'm building a new application for android and this would need to send and retreve data from an online database.
Firstly is this possible or is it a completely wrong approach?
Would i be able to tell my application to set certain data into the server and retreve other?
Does it create security risks by which anyone would be able to access the database?
It's my first time dealing with anything close to databases so i'm still learning.
Is there any website i can use which sets up an accessible SQL database?
Thanks for your help!
The Good approach for this is that you should create REST (Representational State Transfer) API on server and perform CRUD operations in your Android app using that API.
There are a lot of security problems with embedding direct database access into your app.
Usually,REST architecture is very useful to build client/server network applications. REST basically works on HTTP protocol and implementing REST is very simple compared to other methods like WSDL etc.
There are many good tutorials available on implementation of REST API that you can easily find by Googling it.
Here's one of them: http://www.androidhive.info/2014/01/how-to-create-rest-api-for-android-app-using-php-slim-and-mysql-day-12-2/
Yes, it is possible and it is not the wrong approach. Web services/REST API's are some things you should look at.
There are obvious security risks associated with having an outward facing web service or database. OWASP has a pretty good
web services guide that should get you started with the
security. You will need to address these risks prior to holding any sensitive/user information. There are plenty of guides online.
A couple of database hosting suggestions Amazon Web Services if you want it to be manage dfor you or create a VPS at Digital Ocean (or similar) website if you want to do it yourself.
Due to the open ended nature of this question there are numerous ways you can address these problems. I recommend spending a lot of time researching and analyzing them prior to starting the project and deciding on a technology.
This is not a wrong approach, most of the Android application send or receive data from online databases.
For connecting your Android app with the online database you can make of webservices , for instance you can create Rest Api for this.
For creating Rest Api using Asp.net web api visit this link
The answer for your last question would depend on the way your write your web services decide the security risk.
You can also use this reference

MYSQL and SQLite

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

Android - Connect to MSSQL online database

I'm new to Android programming. I have a website with sql 2008 db, and now i would like to give the users the ability to use their smart phones to enter data to this db.
I was wondering what is the best way to establish it. Since I'm new to it I don't want to build something that's not so professional.
Thanks for your help.
If I were you I would consider two following options:
Have a web application optimised for mobile use;
Pros:
Updates are delivered immediately, as there's no client application, everything is done on the server;
Web application can be used on many devices with a browser and not just Android: iPhone, Blackberry, PC, Mac, etc.;
Cons:
Users need to be online to work with the application;
You can not leverage from the native UI components available to native device applications;
Write Android application that will work with the database via a number of REST endpoints exposed through a web application (again);
The pros and cons are a full reverse of what you had in the first option.
The right answer for me was to use KSoap library. I'ts very easy and works very well.
Here is a tutorial that will show you how to do it step by step.
http://java.dzone.com/articles/invoke-webservices-android

Categories

Resources