Integrate a finished web service in a Android application - java

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

Related

How to create chat with API Gateway using sockets [JAVA]

I am trying to create small aplication with CLI, API and microservices. I've already created a few needed microservices eg. login, registration. Now, I am focused on creating chat. I have no clue how to corectly comunicate client (CLI) with API(server that choose mode that user send) and API with microservice. I work with G4G code trying to convert it to my purposes: Server, Client. I am adding simple picture of my project.
Simple example:
Another more detailed but in native language

How to use Slack's OAuth2 with a Java desktop application

Is there a way to authenticate a java desktop application with Slack using OAuth2? I am trying to follow Slack's guide.
I am getting stuck because it says you get the access token inside of the redirect uri of your application. But since the app I am making does not exist inside of the web browser, is there anyway I can do this?
Can my java application launch a localhost site that it can communicate with to use as the redirect uri? If so, how?
Desktop app as internal integration
Before we get into more details please note that there is an easy solution if you plan to use your desktop app for your own Slack workspace ONLY. In that case your app does not need to support the full Oauth work flow and you have two options:
Install your app as internal integration via the management page
of your Slack app and then copy & paste the token to your desktop app
Create a legacy token for your Slack workspace and then copy & paste to your desk (not recommended)
I also like to clarify upfront that your app only needs to run the Oauth process ONCE for installing it into a new Slack workspace. The resulting token has no expiration date and has not to be refrehed.
Desktop app for multiple Slack workspaces
If you plan to distribute your desktop app to multiple Slack workspaces you will need to support the full Oauth installation process.
Slack is using Oauth 2.0, so in principle all the standard answers from this older Oauth wiki article should work for Slack too.
However, since you can not assume that the local machines of your users are reachable from the Internet (e.g. redirecting back to a local web server will not work, since Slack will most likely not be able to reach it), you will need a web helper app that runs on a web server and is reachable from the Internet.
This web helper app is basically a small web site, which performs the complete Oauth dance for the installation process into a new Slack workspace. You app can open a browser window and redirect to the web helper app to start the login process. You then have two basic approaches how to handle the connect back to your desktop app:
Show the resulting token to the user and ask him to copy & paste it
to your desktop app (simple approach)
Store the resulting token in your web helper app and provide an API to your desktop app to fetch it automatically. (user-friendly approach)
If you are looking for a starting point for such a web helper app, take a look at this example PHP script for installing Slack apps.

Android app communication with web server?

I am coming from java based web application background where client is thin client i.e. browser and all UI pages(HTML,CSS,JS) along with
data comes from server. But with recent read on net about android based mobile apps and based on Q/A on stack overflow came with this understanding
Android app with backend(where data is fetched from server) is like two application communicating with each other on http. When I say two app , these
are one on mobile which is java(android) application and second is on server which is generally exposed through web services which can be in any language
like java/dot net. Is it correct ?
If yes I have one doubt when comparing it with java server based web app This is in regard of where UI pages . In web application,
UI views are returned from server in the forms of HTML. But I am confused where UI pages resides in android app. Is it generally on client side(all ui pages
are downloaded with app . With different events app serves the UI from client side itself but data comes from server) or they are served from server ?
If from server are they served again as HTML or there is some other format that android better gels with ?
May be android app generally should not expect any UI pages from server which means downloaded app should have all UI pages with it.
I think the UI is still on the client while the content for filling of the UI is from the server. This content is transported in HTTP(s) protocol, therefore in HTML format as you said. But one can use other protocols to get the response from the server I guess.

Connecting SQL server 2014 database with android application

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

Java based mobile app+IIS server

I want to develop a mobile application which can work in GPS/GPRS based phones. I heard like Java is the most suitable platform to develop that. But I want to connect this mobile application to the IIS server. Is it possible?
I have one more query.
Is it possible to deploy applications developed using .net mobile in basic gps phones?
Yes. It is possible.
In order to communicate with your IIS server ,
you can create webservice and deploy it over IIS and consume it from j2me app/
you can use URLConnection to make GET POST request to your IIS Server from J2ME Application.
First one is more preferable.
Introduction to J2ME Web Services

Categories