How to check connection time out/connection error

0 votes
Hi, I'm using Cocos2d-X SDK working on Android platform, and i'm trying to solve connection problem,

how can i handle the connection time out / connection error ??

 

thank's for your kindness
asked Feb 24, 2015 in App42 Cloud API-BaaS by imam_choy (12 points)
recategorized Apr 7, 2015 by sushil

1 Answer

0 votes

Hello Imam,

Every platform has own native way to check the internet reachability that internet is connected or not. For Android, please find the code snippet below to check the internet connectivity:

 

ConnectivityManager cm = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);

NetworkInfo activeNetwork = cm.getActiveNetworkInfo();

boolean isConnected = activeNetwork != null &&

activeNetwork.isConnectedOrConnecting();

 

And for iOS,, please have a look at this thread it will help you to solve your problem. 

Please check & let us know if it helps.

Thanks,

Himanshu Sharma

answered Feb 24, 2015 by hs00105 (2,005 points)
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on support@shephertz.com
...