- Home /
send json with https using post on android can't get response.
I tried to send json to server use WWW function using sertificate and https, when I run on desktop seems running normal, but when I build for android, there's nothing happen. It's no error or no result. Here's script
IEnumerator SendingScore()
{
string data = "{\"campaignId\":\"" + 46 + "\",\"score\":\"" + 5000 + "\",\"mobileNo\":\"" + 0233256565 + "\"}";
Debug.Log(data);
Hashtable headers = new Hashtable();
headers.Add("Content-Type", "application/json");
headers.Add("Secret-key", "secretkey");
byte[] pData = System.Text.Encoding.UTF8.GetBytes(data);
WWW webRequest = new WWW("https://blahblahblah/blah", pData, headers);
yield return webRequest;
if (webRequest.error == null)
{
txtReward.text = webRequest.text;
Debug.Log(webRequest.text);
}
else
{
txtReward.text = webRequest.text;
Debug.LogError(webRequest.text);
}
}
sorry i replace the link with blahblah for my company privacy. Thank you..
Comment
Do you have the permission in the manifest:
<uses-permission android:name="android.permission.INTERNET" />
Your answer
![](https://koobas.hobune.stream/wayback/20220612044422im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How do I add a header and a file at the web request at the same time? 0 Answers
HttpWebRequest to https on Android? 1 Answer
Log in on a website and get data 0 Answers
Android : www.error 401 when using credentials in URL over HTTPs 0 Answers
https -- works in IDE & Standalone, does not work in web browser 1 Answer