/*** @ Title hassd * @ description determines whether an SD card exists * @ Param @ return * @ return Boolean * @ date 2012-10-25 9:03:56 */private Boolean hassd () {If (environment. getexternalstoragestate (). equals (Android. OS. environment. media_mounted) return true; else return false ;} /*** @ title isconnect * @ description determines whether a network connection exists * @ Param context * @ return Boolean * @ date 2012-10-22 10:17:18 am * @ author Lizhen */Public stat IC Boolean isconnect (context) {// obtain all connection management objects of the mobile phone (including management of Wi-Fi, net, and other connections) Try {connectivitymanager connectivity = (connectivitymanager) context. getsystemservice (context. connectivity_service); If (connectivity! = NULL) {// obtain the network connection management object networkinfo info = connectivity. getactivenetworkinfo (); If (info! = NULL & info. isconnected () {// determine whether the current network is connected to If (info. getstate () = networkinfo. state. connected) {return true ;}}} catch (exception e) {log. V ("error", E. tostring ();} return false;}/*** @ title isservicerunning * @ Description: determines whether a service is running. The Android system provides the activitymanager function. getrunningservices can list the currently running backend service threads * @ Param servicename * @ Param @ return * @ return Boolean * @ date 9:14:01 * @ author Lizhen */private Boolean isservicerunning (string servicename) {activitymanager manager = (activitymanager) getsystemservice (activity_service); For (runningserviceinfo service: Manager. getrunningservices (integer. max_value) {If (servicename. equals (service. service. getclassname () return true;} return false ;}