Skip to main content
Inspiring
August 3, 2017
Answered

Force an app to close when no internet connection is available

  • August 3, 2017
  • 1 reply
  • 617 views

Hi,

I use Adobe Animate CC to build my apps and I use the Milkmangames ANE to insert Admob banners and interstitials on my free apps.

This goes on the manifest:

uses-permission android:name="android.permission.INTERNET"

uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"

but I have realized that users can use my apps without an internet connection.

So my question is:

- Is there a way to force an app to close when no internet connection is available?

Best Regards.

This topic has been closed for replies.
Correct answer Colin Holgate

Part of the problem is about how much you're willing to upset your users. There are plenty of discussions about that, and how to find a compromise (for example show your own ads if they are offline). See discussions like this one:

http://forums.makingmoneywithandroid.com/marketing-methods/7629-how-show-ads-when-user-offline.html

The first part of the problem is knowing if you're really offline. There are ANEs like this one that can help:

GitHub - freshplanet/ANE-Network-Info: Air Native Extension (iOS and Android) for getting Network Information

Or you could simply have your own text file on your server, and your app tries to read that. If it succeeds you let them play. You could check that file every time an ad is due to play, so that someone who goes offline after starting to play will also see the message that they need to be online to play. If you do tie the check to when ads should appear, you should be fairly sure that you won't cause them to lose a life.

If your own server URL was to a PHP you could even know how many times users have played the app each day.

Hate reviews would reduce your ad revenue more than the amount that people going offline would.

1 reply

Colin Holgate
Colin HolgateCorrect answer
Inspiring
August 3, 2017

Part of the problem is about how much you're willing to upset your users. There are plenty of discussions about that, and how to find a compromise (for example show your own ads if they are offline). See discussions like this one:

http://forums.makingmoneywithandroid.com/marketing-methods/7629-how-show-ads-when-user-offline.html

The first part of the problem is knowing if you're really offline. There are ANEs like this one that can help:

GitHub - freshplanet/ANE-Network-Info: Air Native Extension (iOS and Android) for getting Network Information

Or you could simply have your own text file on your server, and your app tries to read that. If it succeeds you let them play. You could check that file every time an ad is due to play, so that someone who goes offline after starting to play will also see the message that they need to be online to play. If you do tie the check to when ads should appear, you should be fairly sure that you won't cause them to lose a life.

If your own server URL was to a PHP you could even know how many times users have played the app each day.

Hate reviews would reduce your ad revenue more than the amount that people going offline would.

Inspiring
August 3, 2017

Hi Colin,

Thank you for your advices. They are very valuable to me. The point about "Hate reviews" says all I need to know what to do.

Bestr Regards.