Code example for Intent

Methods: getActiongetIntExtra

0
                                        SendReceiveService.class); 
    context.startService(mmsSenderIntent);
  } 
 
  private void handleRadioServiceStateChange(Context context, Intent intent) {
    int state = intent.getIntExtra("state", -31337);
 
    if (state == ServiceState.STATE_IN_SERVICE) {
      sendSmsOutbox(context);
    } 
  } 
 
  private void handleDataServiceStateChange(Context context, Intent intent) {
    ConnectivityManager connectivityManager
      = (ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
 
    NetworkInfo networkInfo = connectivityManager.getNetworkInfo(MmscProcessor.TYPE_MOBILE_MMS);
 
    if (networkInfo != null  && networkInfo.isAvailable()) {
      sendMmsOutbox(context);
    } 
  } 
 
  @Override 
  public void onReceive(Context context, Intent intent) {
    if (intent == null) return;
 
    if (intent.getAction().equals(ACTION_SERVICE_STATE)) {
      handleRadioServiceStateChange(context, intent);
    } else if (intent.getAction().equals(ACTION_CONNECTIVITY_CHANGE)) {
      handleDataServiceStateChange(context, intent);
    } 
  } 
 
} 
Experience pair programming with AI  Get Codota for Java