Internet connection suddenly not working

Hello all again!

I’ve been inactive on this forum for a long time but now I have a question.

About 2 years ago, I published my first game developed with Corona SDK. Everything worked well, people were playing it and so on. Because I was curious I wanted to try out my game again, I downloaded it and installed and then got disappointed. Suddenly internet connection stopped working, that is, even I’m connected (wireless or via my mobile provider) I keep getting “Internet connection problem” message. 

I would like to fix my game to work again as it is available on Google Play. Has something changed with Corona and connectivity/network? Do I need to update something maybe?

I’m confused because I didn’t change anything, but simply app’s connectivity stopped working after 2 years. My game cannot connect to internet suddenly.

Please help with some hints.

Do you have the original game files for the game?

Over 2 years i’m sure Corona changed up a bit. Maybe all you have to do is re-build the app from the simulator.

Well that is pretty much all i can say with confidence. We might have to wait for someone like a mod.

–SonicX278 

Hi,

I’m not sure what exactly is happening, without some code samples, but have you applied the proper permission in the 'build.setings" file?

On Android, you must add the INTERNET permission to the build.settings file.

[lua]

settings =
{
  android =
  {
    usesPermissions =
    {
      “android.permission.INTERNET”,
    },
  },
}

[/lua]

Hope that helps.

Cheers.

Changes in Corona would not do this if you didn’t rebuild your app.

i.e. If you built the app with a version from Corona 2 years ago and it no longer runs, that would most likely be a Android OS change preventing the app from running.

Simply build your app again with the latest Corona.  Of course, if the app is actually 2 years old, that means you’ll need to  deal with the graphics 2.0 changes.

I would have posted the migration guide link here, but its MIA right now.  Looks like some of the site restructuring has broken a few links.

I’ll keep looking and post the link if I find it.

On a similar topic I’m having problems posting a high score to an online leader board (Dreamlo)

The score is posted fine on the simulator but not on the device, I’ve tried everything I can think of like setting a delay and checking for connectivity.

local test = socket.tcp() test:settimeout(3) local testResult = test:connect("www.google.com", 80) local delaySend = function() if testResult then network.request( playerData.dream.."add/"..HighScoreNames[n][i].."/"..HighScores[n][i].."/"..HighScoreLevels[n][i].."/"..\_GData.country, "GET", networkListener ) end end local myTimer = timer.performWithDelay( 3500, delaySend, 1 )

As I said, the data is sent fine on the simulator, any ideas anyone?

@quizmaster,

Android or iOS?

Don’t forget about recent policy change with iOS and http.

https://docs.coronalabs.com/guide/hardware/appleATS/index.html

@roaminggamer

Thanks for the reply.

I’m only concentrating on Android right now, and that’s enough headache, iOS comes next.

So your answer is out of context I’m afraid.

Do you have any more ideas why I can post the table online on the simulator (which has always worked) but not on my Android tablet which is a Samsung Galaxy Tab 4?

So, reading the new iOs app transport security docs, has this had any effect with Android too that I should know about?

The reason I’ve gone with my own online high score table was to make things easier, rather than going through Google Play Game Services.

@QuizMaster - Did you get this figured out? I’m in the midst of reinstalling my toolchain, but can take a look once I can put something on a device.

Are you using the Corona Viewer to test by any chance?

Let me know.

Cheers.

@develephant, I don’t have Corona Viewer.

I’m pretty sure I’ve got it working now but I’m still not happy with how it’s working because of the very long delay I have to give it.

What was happening was this.

I upload the score then download the high score table for display.

If I download the high score table too quickly the upload never gets added to it.

So what I’ve had to do is put a 4 second delay between the two operations.

Also, I have to put a further 3 second delay in the following code or the download doesn’t work either.

local params = {} params.progress = "download" params.response = { filename = "dreamScores.json", baseDirectory = system.DocumentsDirectory } local function networkListener( event ) if ( event.isError ) then world.errorNet = true fTable = 1; tTable = 10 setupWorldTable() else worldTimer1 = timer.performWithDelay( 3000, createTable, 1 ) end end local loadScores = function() timer.cancel( worldTimer1 ) worldTimer1 = nil network.request( playerData.dream.."json", "GET", networkListener, params ) end

Bad things happen in my game while all of this is going on, buttons become unresponsive and things get jittery.

In my previous post you can see I’m checking that the device is connected to the internet and I’ve found that I need to give it at least 3 seconds to test the connection.

All in all it’s adding up to a 10 second delay which is awful.

It would be nice to hear from anyone else who has experienced this before and how they handled it, I could really do with some advice.

I’ve had my game in Google Play Beta test since Christmas and this is the last thing I have to get right before I promote it to full production.

Do you have the original game files for the game?

Over 2 years i’m sure Corona changed up a bit. Maybe all you have to do is re-build the app from the simulator.

Well that is pretty much all i can say with confidence. We might have to wait for someone like a mod.

–SonicX278 

Hi,

I’m not sure what exactly is happening, without some code samples, but have you applied the proper permission in the 'build.setings" file?

On Android, you must add the INTERNET permission to the build.settings file.

[lua]

settings =
{
  android =
  {
    usesPermissions =
    {
      “android.permission.INTERNET”,
    },
  },
}

[/lua]

Hope that helps.

Cheers.

Changes in Corona would not do this if you didn’t rebuild your app.

i.e. If you built the app with a version from Corona 2 years ago and it no longer runs, that would most likely be a Android OS change preventing the app from running.

Simply build your app again with the latest Corona.  Of course, if the app is actually 2 years old, that means you’ll need to  deal with the graphics 2.0 changes.

I would have posted the migration guide link here, but its MIA right now.  Looks like some of the site restructuring has broken a few links.

I’ll keep looking and post the link if I find it.

On a similar topic I’m having problems posting a high score to an online leader board (Dreamlo)

The score is posted fine on the simulator but not on the device, I’ve tried everything I can think of like setting a delay and checking for connectivity.

local test = socket.tcp() test:settimeout(3) local testResult = test:connect("www.google.com", 80) local delaySend = function() if testResult then network.request( playerData.dream.."add/"..HighScoreNames[n][i].."/"..HighScores[n][i].."/"..HighScoreLevels[n][i].."/"..\_GData.country, "GET", networkListener ) end end local myTimer = timer.performWithDelay( 3500, delaySend, 1 )

As I said, the data is sent fine on the simulator, any ideas anyone?

@quizmaster,

Android or iOS?

Don’t forget about recent policy change with iOS and http.

https://docs.coronalabs.com/guide/hardware/appleATS/index.html

@roaminggamer

Thanks for the reply.

I’m only concentrating on Android right now, and that’s enough headache, iOS comes next.

So your answer is out of context I’m afraid.

Do you have any more ideas why I can post the table online on the simulator (which has always worked) but not on my Android tablet which is a Samsung Galaxy Tab 4?

So, reading the new iOs app transport security docs, has this had any effect with Android too that I should know about?

The reason I’ve gone with my own online high score table was to make things easier, rather than going through Google Play Game Services.

@QuizMaster - Did you get this figured out? I’m in the midst of reinstalling my toolchain, but can take a look once I can put something on a device.

Are you using the Corona Viewer to test by any chance?

Let me know.

Cheers.

@develephant, I don’t have Corona Viewer.

I’m pretty sure I’ve got it working now but I’m still not happy with how it’s working because of the very long delay I have to give it.

What was happening was this.

I upload the score then download the high score table for display.

If I download the high score table too quickly the upload never gets added to it.

So what I’ve had to do is put a 4 second delay between the two operations.

Also, I have to put a further 3 second delay in the following code or the download doesn’t work either.

local params = {} params.progress = "download" params.response = { filename = "dreamScores.json", baseDirectory = system.DocumentsDirectory } local function networkListener( event ) if ( event.isError ) then world.errorNet = true fTable = 1; tTable = 10 setupWorldTable() else worldTimer1 = timer.performWithDelay( 3000, createTable, 1 ) end end local loadScores = function() timer.cancel( worldTimer1 ) worldTimer1 = nil network.request( playerData.dream.."json", "GET", networkListener, params ) end

Bad things happen in my game while all of this is going on, buttons become unresponsive and things get jittery.

In my previous post you can see I’m checking that the device is connected to the internet and I’ve found that I need to give it at least 3 seconds to test the connection.

All in all it’s adding up to a 10 second delay which is awful.

It would be nice to hear from anyone else who has experienced this before and how they handled it, I could really do with some advice.

I’ve had my game in Google Play Beta test since Christmas and this is the last thing I have to get right before I promote it to full production.