On my side, I created a library in c++ which uses a different file depending on the platform.
a .mm file on ios
a .java file on android and another .cpp for the JNI bridge
directly a .cpp file on windows8.1
You can easily to the same I guess.
I cannot share my files, they are part of a big library.
Are you allowed (ie app store approval) to perform your ‘reachability’ using the method’s above - even though they use some cellular data etc. Is it ok to ping google as long as you handle it elegantly (no crashes or poor ui).
Or, must you confirm reachability before attempting any internet access?
I’m not sure it’s disallowed by Apple (or Microsoft/google), but it’s definitely not a good practice to charge the user with unnecessary cellular data (even a dns+ping message). Especially if we can achieve the same goal using system functions.
The Connectivity.java file is located in proj.android/com/emil/android/util. But the checkConn above always returns false. Can you point what I am missing here?
hello i wrote a wrapper for ios and android internet checking. You can reach it fromthis github link
It has three features (hasInternetConnection, isConnectionFast, isConnectionMobile) for iOS and android but if you want you can add another ones. Hope It helps someone.
Hello sir, i am adding this class that time i will occur bellow issue. please help me to solve it.
Undefined symbols for architecture x86_64:
“OBJC_CLASS$_Reachability”, referenced from:
objc-class-ref in Connectivity.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)