Code example for PowerManager.WakeLock

Methods: acquire

0
    } else if (connectivityListener == null) {
      IntentFilter filter  = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
      connectivityListener = new ConnectivityListener();
      context.registerReceiver(connectivityListener, filter);
 
      wakeLock.acquire();
    } 
  } 
 
  protected boolean isConnectivityPossible() { 
    NetworkInfo networkInfo = connectivityManager.getNetworkInfo(TYPE_MOBILE_MMS);
    Log.w("MmsService", "Got network info: " + networkInfo);
    return networkInfo != null  && networkInfo.isAvailable();
  } 
 
  protected void finishConnectivity() { 
    Log.w("MmsService", "Calling stop using network feature!");
    connectivityManager.stopUsingNetworkFeature(ConnectivityManager.TYPE_MOBILE, FEATURE_ENABLE_MMS);
 
    if (connectivityListener != null) {
Contextual code suggestions in your IDE  Get Codota for Java