Android internet connectivity check problem

后端 未结 5 1465
借酒劲吻你
借酒劲吻你 2020-11-28 14:06

I\'m new to Android development and working on an Android application that requires the phone to be connected to the internet, through either Wifi, EDGE or 3G.

This

5条回答
  •  迷失自我
    2020-11-28 15:03

    If the crash is directly on your line:

    return cm.getActiveNetworkInfo().isConnectedOrConnecting();
    

    then that means getActiveNetworkInfo() returned null, because there is no active network -- in that case, your isConnected() method should return false.

提交回复
热议问题