Skip to content
Advertisement

How to send JSONArray to PHP server using Volley?

I’m fairly inexperienced with Android programming and am having issues sending a JSONArray to my PHP server. I am using the following code to generate the JSONArray from my cursor:

JavaScript

I believe I am misunderstanding how to properly send data via JsonARrayRequest. Here is the following code that I am using to send the data.

JavaScript

Instead of sending the data, I am left with a blank array. The cursor to JSONarray function is working properly as I can see in debug, but the php server is receiving a blank array. I assume there is some essential functions I am missing.

Advertisement

Answer

Fixed it by switching my array into a string and then using a StringRequest to send the data.

Updated function:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement