简体   繁体   中英

How to communicate between Laravel and Android?

I want to understand the communication between a web application written in Laravel and an Android one. I would like to know how should I structure the folders since they will have different functionalities for the web platform and for the mobile. Thanks in advance.

You have to create WEB API to achieve this.

What is an API?

In this sense an API - which stands for Application Programming Interface - allows for publicly exposed methods of an application to be accessed and manipulated outside of the program itself. A common usage of an API is when you wish to obtain data from an application without having to actually visit the application itself. To allow this action to take place, the application has published an API that specifically allows for foreign applications to make calls to its data and return said data to the user from inside of the external application.

How to create WEB API help

To communicate across different platform you can use JSON to pass the data and read that data.

In Laravel just create the API which returns JSON data and access that API in Android using AsyncTask , Volley , HttpUrlConnection , OkHttp .

Just search on the internet you will find lots of resources.

Check this link to create API in Laravel .

Firstly, write the Web API using the Lavarel to enhance communication between the android app and the web application. Ensure you test the json file using Postman to check if it returns valid json parameters. Then use either Retrofit, Volley in Android to communicate with the android application to parse JSON objects to enable access to information at real time...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM