Android service connection via JSON to MS SQL backend - android

I and a colleague of mine are making an Android app for a bachelor project, and are not aware of what we should use in order to connect an Android device to an MS SQL database. The possible options we have considered so far are either using MVC4, WCF or Web API. We are trying to send just a bunch of strings from the database to the Android device, but we do not have extensive knowledge about either of the fore-mentioned technologies and we are wondering what is the best way and how to go about it all. We are also not aiming at creating a webpage for the project, and thus we think that MVC might be an overkill.
Thank you and we are looking towards your thoughts about this!

Related

How can I store a single database for multi device access in Delphi 10.3?

I am new to multi-device development in Delphi and I have a basic VCL background. I have worked with multiple projects that use locally stored databases for their functions etc.
Coding is a hobby and I want to learn more about mobile app development for personal usage. I am busy writing a simple application that serves as a scoring system for a card game that we invented. I am currently using SQLite local database to store data.
I am now looking for a way to have a single database that multiple devices can access so that any one of our android smartphones can run the application and interact with the data in that database.
At this stage, I don't really have extensive knowledge about what I am talking about and I want some advice regarding this problem. Is a single database the best solution? Is there perhaps a different approach?
I am familiar with basic FireDac syntax (TFDConnection, TFDQuery, and TFDTable), so I would prefer maybe keeping a FireDac infrastructure if possible.
I would prefer the solution to not be too complicated :)
I do hope that I presented the problem clearly. Please ask if something sounds unclear - I will try my best to elaborate.
I am using Delphi 10.3 (Community Edition)
There are many solutions to this problem. I won't expose all possibles but only the one I think is best:
You need a server somewhere in the cloud to keep data from different devices and you have to make your application communicate with that server. You can build server side with Delphi, or other tool.
I recommend a REST architecture over HTTPS using JSON format to send/receive data to/from devices.
Delphi has everything required to build both client (Your devices) and server side. Not sure for Community Edition. If not included in CE, you may use third party libraries to accomplish the same task.
You next step is to think about that solution, do some research by yourself, write some code and when you are stuck, ask another question on StackOverflow.

Android Application Backend from scratch

I am developing an android application which needs a backend to process login and store data remotely on a server. I have previously worked with a BaaS service "Parse" for android. but since this is my final year project for my university I need to develop a backend from scratch, I have never worked with web services. I need some guidance on how to approach this and which framework will be the best to work with.
Thanks in advance.
If I understand you correctly you want to build a server application that allows you query data from your android app?
I'm not an expert on this since i just started coding myself, but I did do some research and it seems to be a very viable option to implement a RESTful API on the server side. The wiki article is pretty specific about how it works.
If you can use PHP the slim framework allows you to get a scrappy prototype RESTful API up in less then an hour if you familiar with the server configuration. It seems to be sophisticated enough to drive small and medium sized projects (maybe even big projects; I can't tell to be honest.)
On the start page you can see an example that allows you to query for a "hello, world" string from the API with less then 50 lines of code.
http://www.slimframework.com/
Where the example returns a "hello world" string you would perform database queries using PHP and return your results as json objects to your client.
The benefits of this are that you can use this Backend for different clients: Android, iOS or even your own browser-based web application.
This also makes it easy replace / port the backend once requirements change since it's very easy to implement the same API using other technologies and languages that fit the requirements better.

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

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

Data exchange with remote server in Android

I'm building an application for android which collects user data.
Also I'm going to build a website which will use that data where users can have an account and synchronize data with phone and website (I guess it's quite common setup).
Site will be using MySQL database, but I want it to be database independent using some kind of API.
I think I'm going to use Python for website (Django).
Since I haven't started whole synchronization part yet I have a question on how to do it best.
Which protocol to use - JSON, SOAP, XML (any other)? Which is best supported in android?
What are the best practices in doing such a thing?
Leonti
Android lacks a built-in API for processing SOAP or XML-RPC requests, so I would go with a REST-style Web service. JSON is probably the easiest from an Android perspective to consume and create.

Categories

Resources