Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

using this extension - on android, the isConnected() returns true always #24

Open
StephenKDS opened this issue Aug 23, 2015 · 5 comments

Comments

@StephenKDS
Copy link

During testing, this is always returning true, even with WIFI/DATA disabled. :-/

Any idea what is happening?

    #if(android || ios)
    if (NetworkInfos.isConnected()) {
        DebugLogging.addDebugLogEntry("Main.new", "is connected to the network");
    }
    else {
        DebugLogging.addDebugLogEntry("Main.new", "is NOT connected to the network");
    }
    #end
    #if flash
        DebugLogging.addDebugLogEntry("Main.new", "FLASH detected, not checking for network connectivity");
    #end    
@chichilatte
Copy link

Not even sure how you got that far! When I tried a quick test I got...
/usr/lib/haxe/hyp-system/0,2,1/hypsystem/net/NetworkInfos.hx:50: characters 8-9 : Void should be hypsystem.net.ConnectionType (OSX10.10.5, haxe 3.2.0, haxelib 3.2.0-rc.3)

Did you find a reliable way to get this working @StephenKDS?

@shoebox
Copy link
Member

shoebox commented Sep 15, 2015

Cf the android docs:
http://developer.android.com/reference/android/net/NetworkInfo.html#isConnected%28%29

If you want to ensure than wifi or 3g is on, just call getConnectionType and check for at least wifi or 3g... depending of your needs.

@chichilatte that mean than the inthebox-macros mirroring is not working.
All that has not been tested yet on haxe 3.2

@chichilatte
Copy link

Ah, thanks for the quick reply Johann! What a drag. You recommend haxe 3.1?

@StephenKDS
Copy link
Author

I took a copy of the extension source locally, and fixed that issue to test it working. I was going to do a pull request if it worked, but sadly it wasn't giving the results I was expecting :-/

@mastef
Copy link

mastef commented Jul 26, 2016

@shoebox @chichilatte Updated inthebox-macros to latest but also ran into that issue ( hypsystem/net/NetworkInfos.hx:50: characters 8-9 : Void should be hypsystem.net.ConnectionType ). Had to change

        var res:ConnectionType = switch(type)
        {
            case 0:
                ConnectionType.NONE;

            case 1:
                ConnectionType.WIFI;

            case 2:
                ConnectionType.MOBILE;

            case _:
        }

to

        var res:ConnectionType = switch(type)
        {
            case 0:
                ConnectionType.NONE;

            case 1:
                ConnectionType.WIFI;

            case 2:
                ConnectionType.MOBILE;

            case _:
                ConnectionType.NONE;
        }

So it would provide a default value. Is there a better way or will this be patched? ( Since I don't really want to hack extensions due to overwrites by updates )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants