Scoreboard showing only Wi-Fi

Updated on August 23, 2019 in General
Share on Facebook0Tweet about this on TwitterShare on Google+0Share on Reddit0
5 on August 22, 2019

Hello guys, when I click to scoreboard button score list showing only when I connected wi-fi. How can I show it even mobile data. Internet permission is auto on permissions section. Is it about this?

  • Liked by
Reply
0 on August 22, 2019

I am just yielding www and checking 

if (string.IsNullOrEmpty(www.error))

then getting data. On mobile internet this probably returning error. Why?

  • Liked by
Reply
Cancel
0 on August 22, 2019

Can you show your function where this is happening please?

It might just be a speed thing. It’s returning too slow over mobile data, and Unity just thinks it returned null, because it didn’t have time to populate it yet.

  • Liked by
Reply
Cancel
0 on August 22, 2019
WWW www = new WWW(targetAddress);
 yield return Timing.WaitUntilDone(www);
if (string.IsNullOrEmpty(www.error))
    FormattedHighScore(www.text,gameType,optional);

 

void FormattedHighScore(string rawText,int gameType,bool optional)
 {
 string[] rawHighScore = rawText.Split(new char[] { '\n' },System.StringSplitOptions.RemoveEmptyEntries);
int len = rawHighScore.Length;
 HighScore[] highScoresList = new HighScore[len];
for (int i = 0; i < len; i++)
 {
 string[] highScoreInfo = rawHighScore[i].Split('|');
 string username = highScoreInfo[0];
 username = username.Replace('+', ' ');
 int score = int.Parse(highScoreInfo[1]);
 highScoresList[i] = new HighScore(username, score);
 }
MenuManager.Instance.WriteTopTen(highScoresList);

 

just this

  • Liked by
Reply
Cancel
0 on August 22, 2019

Button click calling first one. After yielding www format all of them and show.

  • Liked by
Reply
Cancel
0 on August 23, 2019

I solved the problem. Error occurring just android 9(api 28) and over.

<application
android:usesCleartextTraffic=”true”

I added this to manifest file. This is already true android 8 and older versions.

We have two option here:

1- android:usesCleartextTraffic=”true”

2- request http instead of www.

  • Liked by
Reply
Cancel