Lab#8 Mad

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

Android Development: Lab#8, Android Restful Web Service

Lab # 8

Android Restful Web Service

Objective:
To give the basic understanding of the following:

 Android Restful Web Services


 What is Web Services

Android Restful Web Service


Before developing web services application, you must have basic knowledge of SOAP and
Restful web services. That is why, we are going to discuss basic points about web services
such as what is web service and brief information about SOAP and Restful web services.

What is Web Service?

A web service is a standard for exchanging information between different types of


applications irrespective of language and platform. For example, an android application can
interact with java or .net application using web services.

Example by using xampp MySQL and volley library.


Instruction to be followed.

1. Install xampp and nodepad ++


2. Create these php files and place in the directory of htdocs inside xampp.
3. Mention your database name and your ip must be same as your local ip and populate your
database

LAB INSTRUCTOR: Mohsin Raza Khan


Android Development: Lab#8, Android Restful Web Service

Step#1: Create a new flutter project in android studio using flutter:

Step#2: Creating a database on your phpmyadmin:

Database is very important because without database there is no possible way to creating tables. Now
make a database on your PHPMYADMIN.

Step#3: Create a table in your database:

Create a table in your database named as registered user and create four columns id, name, mobile,
email into that table.

Step#4: Now upload your PHP script on your server:

After finishing table creation process just upload the below two PHP scripts on your server using file
manager. There are two different type of files present here first one is config.php file and second is
insertdata.php file. Please change the details of your server in config.php file.

LAB INSTRUCTOR: Mohsin Raza Khan


Android Development: Lab#8, Android Restful Web Service

LAB INSTRUCTOR: Mohsin Raza Khan


Android Development: Lab#8, Android Restful Web Service

Step#5: Check your PHP script:

After done uploading procedure just open the insertdata.php file URL in your web browser and you can
see that its showing us the user added Successfully message and when you open the PhpMyAdmin
control panel there is a blank value inserted in your table. This value is blank because there is no such
data present for insertion.

Step#6: Now it’s time to write code in flutter:

After done all the back-end procedure now it’s time to write some code for flutter.so in this app simply
we create three TextField named as a name, email & mobile.

Step#7: Now we will create a function for sending data into MySQL:

Exercise:
Make the insert button and the functionality by code.

Tasks:

1) Code and compile above example.


2) Make sign up and registration form.
3) Using JSON file how to display data in your flutter app.

LAB INSTRUCTOR: Mohsin Raza Khan

You might also like