I have a question about json object communication.

Asked 2 years ago, Updated 2 years ago, 83 views

Current server:in Apache php mariadb environment It creates a json object and implements the form that it receives from Android.

Common examples show that the data in db is generated by php as a function of json_code() It's printed out as echo Android httpurl connection or getstringfromurl to read text.

If you know url, you can connect directly to the browser and view the data of the db directly to the text in the form of json. If I want to send an object directly to Android without printing it on the web, should I communicate in a way other than http communication?

json android php http

2022-09-21 14:51

2 Answers

There are ways to use http, and there are times when not

For example, when the app requests, it identifies the agent and shows it if it is a mobile, not a PC, or unconditionally requests it like a token to output it out and so on

For example, you have to look at the weather now Assume

If you just request /date, nothing will be printed.

/date?token=randomtoken. If you add a token and send it, it's output

The above method is not RESTFUL

You literally print it out using udp or tcp. You can't really see it on the web.

Instead, there's more to be done than http


2022-09-21 14:51

If you asked me to send json data from the web to Android,

I think you can implement it in a push method.

Using API on web, send push to GCM app

In the app, if you receive a push, you can call a specific url to get json data.

When importing, it looks better to import at http/https. (I don't know in detail how much data I can send to GCM and what restrictions there are.))


2022-09-21 14:51

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.