I have created a database with SQL server 2014, and i want to connect and access it from android application im developing in android studio.
is it possible without creating a web service?
Never ever do any heavy weighted operations such as directly connecting to an sql server since consumes heavy battery and it requires huge data consumption where the end users might not prefer.So The only light weighted way present is to use your own TCP based logic layer i.e giving a call to web services.
You can refer to KSOAP2 library in connecting to your webservice which gives you a response to the request you make.If you are a programmer of .net you can write an asmx web service.And connecting to to the web service is given clearly in this link Connecting to ASMX Web Services
Related
I am trying to connect and communicate between Windows application and andriod apllication. I have used .Net Socket but it is only appllicable for windows. how can i code in andriod application using Java programming language and make communication between two seperate devices (windows and andriod).
I want windows application act as a client and andriod apllication as a server. The server receives the data from client, processes the data and returns the result to the client.
Thank you all in advance
There are several ways to connect and communicate between a Windows application (developed in C#) and an Android application (developed in Java). Here are a few options:
1/ Use a web service: One option is to create a web service that both the Windows and Android applications can access. The web service can be hosted on a server and both the Windows and Android applications can send HTTP requests to the web service to retrieve or send data. This is a good option if the applications need to communicate with each other over the internet.
2/ Use a local network connection: If both the Windows and Android applications are on the same local network, you can use a local network connection to communicate between the two. For example, you can use sockets to create a connection between the two applications and send data back and forth.
3/ Use a shared database: Another option is to use a database that both the Windows and Android applications can access. You can set up a database server and have both applications connect to it to retrieve and store data. This is a good option if you need to store large amounts of data and need the data to be persistent.
4/ Use a cloud service: There are also several cloud services that allow you to easily connect and communicate between Windows and Android applications. For example, Google's Firebase provides a real-time database that can be accessed by both Windows and Android applications, as well as other features such as push notifications and authentication.
It's worth noting that each of these options has its own set of pros and cons, and you'll need to choose the one that best fits your needs.
I am just a beginner in android app development and that's why I have many doubts. I am building one application where the user enters some data in editText. Now I want to save that data in my database. My database is running on my laptop. How would my app connect to the database? Do I need a web server in between? If yes then which web server is used for Android apps? Basically, i want to know the flow of data from app to the database.
Study more from Udacity.com, its free.
You may use a jdbc Connector to connect to database.
Connect your jdbc connector over local network ip\servername and database connection string
You can use REST Service when it comes to web Service on Android like this. You can either pass the values as parameters or an Object depending on your requirement. All the best
Wamp server is best option to play with server related utilities.You can use it even if you are offline. and it provides various option for data storage. It Mainly uses MySql and PHP scripts for fast performance.
For More details Click Here
I don't know if the correct term is "integrate" or "connect" a finished web service in a android application. I mean,
Is there any possibility to "integrate" a finished RESTful Web Service in a Android application, which I have not developed, yet.?
Otherwise,
Are there some steps to develop a RESTful web service which I need to use from a Android application?
The last question is asked because I don't know if the first step is to finish my RESTful Web Service and then integrate it in my android application or or developing the RESTful web service and the android application at the same time.
In any case, how I can do it well? I need help to organise my mind
You will need three things:
Client(your app)
Server
Database
Lets say you have to create a login service for your app. Then your steps should be like given below:
Create a login form with android UI.
Get username and password from Edit Texts in strings.
Send these credentials to server(via http reqest).
At client side read response from url via input stream.
At the server side, use a server side technology in which you are familiar with.(If you are not familiar with any server side tech. I strongly recommend you php.)
Select/update/compare (Whatever you want) in data base and return response as a json string.
You can use server on your system. I suggest to use XAMPP(cross platform apache mysql php perl). As its name says, it includes server+database+php (its local). It will create a local apache server on your machine.
Follow this : XAMPP Tutorial , Working with XAMPP
Here are some nice tutorials of web services with android:
How to connect Android with PHP, MySQL
Using Database from an Android Application
I am working on an android application which needs to fetch data from a cloud server . I know how to send a post request to a server and get data in return but i have never worked with cloud server before . https://developer.android.com/guide/topics/data/backup.html
i have visited this website but it's not that much of help to me i am confused as to how to send request to the server and retrieve data . I don't know anything about cloud servers .
A cloud server is just a normal server hosted in a some 'cloud providers' data centre. It is typically a virtual server - i.e. a single physical server running multiple virtual servers.
From your point of view you can think of it as just a regular server.
What may be causing confusion is that there are also 'Mobile Backed as a Service' providers - these allow you interact with servers, typically ones hosted in a cloud, but may allow you interact with them using a mobile SDK (or library) rather than using traditional client server communication. Your app usually needs to know nothing about the individual servers and you yourself don't need to create or manage any servers either.
Take a look here for a good overview of this latter approach:
https://parse.com/docs/android/guide
I've been doing a lot of reading about this subject and I am now of the conclusion that to communicate between a 2008 SQL Server database and an Android application, I need to create a RESTful Service to sit in between that returns JSON objects.
Would I be correct in saying that?
Yes, you need doing a server application who take data and returns to the Android application. JSON let you return complex objects.