当前位置: 首页>>代码示例>>Java>>正文


Java SmsManager.RESULT_ERROR_RADIO_OFF属性代码示例

本文整理汇总了Java中android.telephony.SmsManager.RESULT_ERROR_RADIO_OFF属性的典型用法代码示例。如果您正苦于以下问题:Java SmsManager.RESULT_ERROR_RADIO_OFF属性的具体用法?Java SmsManager.RESULT_ERROR_RADIO_OFF怎么用?Java SmsManager.RESULT_ERROR_RADIO_OFF使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.telephony.SmsManager的用法示例。


在下文中一共展示了SmsManager.RESULT_ERROR_RADIO_OFF属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: handleSentResult

private void handleSentResult(MasterSecret masterSecret, long messageId, int result) {
  try {
    EncryptingSmsDatabase database = DatabaseFactory.getEncryptingSmsDatabase(context);
    SmsMessageRecord      record   = database.getMessage(masterSecret, messageId);

    switch (result) {
      case Activity.RESULT_OK:
        database.markAsSent(messageId, false);
        break;
      case SmsManager.RESULT_ERROR_NO_SERVICE:
      case SmsManager.RESULT_ERROR_RADIO_OFF:
        Log.w(TAG, "Service connectivity problem, requeuing...");
        ApplicationContext.getInstance(context)
            .getJobManager()
            .add(new SmsSendJob(context, messageId, record.getIndividualRecipient().getNumber()));
        break;
      default:
        database.markAsSentFailed(messageId);
        MessageNotifier.notifyMessageDeliveryFailed(context, record.getRecipients(), record.getThreadId());
    }
  } catch (NoSuchMessageException e) {
    Log.w(TAG, e);
  }
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:24,代码来源:SmsSentJob.java

示例2: onReceive

@Override
public void onReceive(Context context, Intent intent) {
    switch (getResultCode()) {
        case Activity.RESULT_OK:
            Toast.makeText(getBaseContext(), "SMS enviado", Toast.LENGTH_SHORT).show();
            break;
        case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
            Toast.makeText(getBaseContext(), "Falha geral", Toast.LENGTH_SHORT).show();
            break;
        case SmsManager.RESULT_ERROR_NO_SERVICE:
            Toast.makeText(getBaseContext(), "Sem serviço", Toast.LENGTH_SHORT).show();
            break;
        case SmsManager.RESULT_ERROR_NULL_PDU:
            Toast.makeText(getBaseContext(), "Null PDU", Toast.LENGTH_SHORT).show();
            break;
        case SmsManager.RESULT_ERROR_RADIO_OFF:
            Toast.makeText(getBaseContext(), "Radio off", Toast.LENGTH_SHORT).show();
            break;
    }

    unregisterReceiver(this);
}
 
开发者ID:if710,项目名称:2017.2-codigo,代码行数:22,代码来源:SmsSendDirectActivity.java

示例3: handleSentMessage

/**
 * Callback method to handle the result of attempting to send a message. 
 * Each message is assigned a Broadcast receiver that is notified by 
 * the phone's radio regarding the status of the sent message. The 
 * receivers call this method.  (See transmitMessage() method below.)
 * 
 * @param context
 *            The context in which the calling BroadcastReceiver is running.
 * @param receiver
 *            Currently unused. Intended as a special BroadcastReceiver to
 *            send results to. (For instance, if another plugin wanted to do
 *            its own handling.)
 * @param resultCode, the code sent back by the phone's Radio
 * @param seq, the message's sequence number
 * @param smsMsg, the message being processed
 */
private synchronized void handleSentMessage(Context context,
                                            BroadcastReceiver receiver, int resultCode, String smsMsg) {
  switch (resultCode) {
    case Activity.RESULT_OK:
      Log.i(TAG, "Received OK, msg:" + smsMsg);
      Toast.makeText(activity, "Message sent", Toast.LENGTH_SHORT).show();
      break;
    case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
      Log.e(TAG, "Received generic failure, msg:" + smsMsg);
      Toast.makeText(activity, "Generic failure: message not sent", Toast.LENGTH_SHORT).show();
      break;
    case SmsManager.RESULT_ERROR_NO_SERVICE:
      Log.e(TAG, "Received no service error, msg:"  + smsMsg);
      Toast.makeText(activity, "No Sms service available. Message not sent.", Toast.LENGTH_SHORT).show();
      break;
    case SmsManager.RESULT_ERROR_NULL_PDU:
      Log.e(TAG, "Received null PDU error, msg:"  + smsMsg);
      Toast.makeText(activity, "Received null PDU error. Message not sent.", Toast.LENGTH_SHORT).show();
      break;
    case SmsManager.RESULT_ERROR_RADIO_OFF:
      Log.e(TAG, "Received radio off error, msg:" + smsMsg);
      Toast.makeText(activity, "Could not send SMS message: radio off.", Toast.LENGTH_LONG).show();
      break;
  }
}
 
开发者ID:mit-cml,项目名称:appinventor-extensions,代码行数:41,代码来源:Texting.java

示例4: onReceive

@Override
public void onReceive(Context context, Intent arg1) {
    switch (getResultCode()) {
        case Activity.RESULT_OK:
            Toast.makeText(context, "SMS Sent", Toast.LENGTH_SHORT).show();
            break;
        case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
            Toast.makeText(context, "Generic failure",
                    Toast.LENGTH_SHORT).show();
            break;
        case SmsManager.RESULT_ERROR_NO_SERVICE:
            Toast.makeText(context, "No service",
                    Toast.LENGTH_SHORT).show();
            break;
        case SmsManager.RESULT_ERROR_NULL_PDU:
            Toast.makeText(context, "Null PDU", Toast.LENGTH_SHORT)
                    .show();
            break;
        case SmsManager.RESULT_ERROR_RADIO_OFF:
            Toast.makeText(context, "No network",
                    Toast.LENGTH_SHORT).show();
            break;
    }

}
 
开发者ID:webianks,项目名称:HatkeMessenger,代码行数:25,代码来源:SentReceiver.java

示例5: onReceive

@Override
public void onReceive(Context context, Intent intent) {
	switch (getResultCode()) {
	case Activity.RESULT_OK:
		msgReceivedOk(intent);
		break;
	case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
		msgNotSent(intent, "Generic Error.");
		break;
	case SmsManager.RESULT_ERROR_NO_SERVICE:
		msgNotSent(intent, "Error: No Service.");
		break;
	case SmsManager.RESULT_ERROR_NULL_PDU:
		msgNotSent(intent, "Error: Null PDU.");
		break;
	case SmsManager.RESULT_ERROR_RADIO_OFF:
		msgNotSent(intent, "Error: Radio off.");
		break;			
	}
}
 
开发者ID:roadlabs,项目名称:alternate-java-bridge-library,代码行数:20,代码来源:Texting.java

示例6: getSMSSentReceiver

public static BroadcastReceiver getSMSSentReceiver() {
    // For when the SMS has been sent
    return new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
            switch (getResultCode()) {
            case Activity.RESULT_OK:
                Toast.makeText(context, R.string.sms_sent, Toast.LENGTH_SHORT).show();
                break;
            case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
                Toast.makeText(context, R.string.sms_generic_failure, Toast.LENGTH_SHORT).show();
                break;
            case SmsManager.RESULT_ERROR_NO_SERVICE:
                Toast.makeText(context, R.string.sms_no_service, Toast.LENGTH_SHORT).show();
                break;
            case SmsManager.RESULT_ERROR_NULL_PDU:
                Toast.makeText(context, R.string.sms_no_pdu, Toast.LENGTH_SHORT).show();
                break;
            case SmsManager.RESULT_ERROR_RADIO_OFF:
                Toast.makeText(context, R.string.sms_radio_turned_off, Toast.LENGTH_SHORT).show();
                break;
            }
        }
    };
}
 
开发者ID:CesarValiente,项目名称:PermissionsSample,代码行数:25,代码来源:SMSReceiver.java

示例7: onReceive

@Override
public void onReceive(Context context, Intent arg1) {

    setSendRecFired(send_receiver_fired + 1);

    switch (getResultCode()) {
        case Activity.RESULT_OK:
            setResSend(context.getString(R.string.info_sms_sent));
            break;
        case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
            setResSend(context.getString(R.string.info_sms_generic));
            break;
        case SmsManager.RESULT_ERROR_NO_SERVICE:
            setResSend(context.getString(R.string.info_sms_noservice));
            break;
        case SmsManager.RESULT_ERROR_NULL_PDU:
            setResSend(context.getString(R.string.info_sms_nullpdu));
            break;
        case SmsManager.RESULT_ERROR_RADIO_OFF:
            setResSend(context.getString(R.string.info_sms_radioof));
            break;
    }
}
 
开发者ID:tral,项目名称:GPS2SMS,代码行数:23,代码来源:ThreadSendSMS.java

示例8: onReceive

@Override
public void onReceive(Context context, Intent intent) {
	try {
		/* android.content.BroadcastReceiver.getResultCode()���� */
		switch (getResultCode()) {
		case Activity.RESULT_OK:
			break;
		case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
			break;
		case SmsManager.RESULT_ERROR_RADIO_OFF:
			break;
		case SmsManager.RESULT_ERROR_NULL_PDU:
			break;
		}
	} catch (Exception e) {
		e.getStackTrace();
	}
}
 
开发者ID:simplelifetian,项目名称:GomeOnline,代码行数:18,代码来源:Utils.java

示例9: translateResultCode

private static String translateResultCode(int resultCode) {
    switch (resultCode) {
        case Activity.RESULT_OK:
            return "Activity.RESULT_OK";
        case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
            return "SmsManager.RESULT_ERROR_GENERIC_FAILURE";
        case SmsManager.RESULT_ERROR_RADIO_OFF:
            return "SmsManager.RESULT_ERROR_RADIO_OFF";
        case SmsManager.RESULT_ERROR_NULL_PDU:
            return "SmsManager.RESULT_ERROR_NULL_PDU";
        case SmsManager.RESULT_ERROR_NO_SERVICE:
            return "SmsManager.RESULT_ERROR_NO_SERVICE";
        case SmsManager.RESULT_ERROR_LIMIT_EXCEEDED:
            return "SmsManager.RESULT_ERROR_LIMIT_EXCEEDED";
        case SmsManager.RESULT_ERROR_FDN_CHECK_FAILURE:
            return "SmsManager.RESULT_ERROR_FDN_CHECK_FAILURE";
        default:
            return "Unknown error code";
    }
}
 
开发者ID:CommonQ,项目名称:sms_DualCard,代码行数:20,代码来源:SmsReceiverService.java

示例10: smsResultToChar

private static char smsResultToChar(int res) {
	switch (res) {
	case Activity.RESULT_OK:
		return RESULT_NO_ERROR_CHAR;
	case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
		return RESULT_ERROR_GENERIC_FAILURE_CHAR;
	case SmsManager.RESULT_ERROR_NO_SERVICE:
		return RESULT_ERROR_NO_SERVICE_CHAR;
	case SmsManager.RESULT_ERROR_NULL_PDU:
		return RESULT_ERROR_NULL_PDU_CHAR;
	case SmsManager.RESULT_ERROR_RADIO_OFF:
		return RESULT_ERROR_RADIO_OFF_CHAR;
	default:
		throw new IllegalStateException("unknown res=" + res);
	}
}
 
开发者ID:ProjectMAXS,项目名称:maxs,代码行数:16,代码来源:SMSPendingIntentReceiver.java

示例11: onReceive

@Override
public void onReceive(Context context, Intent intent) {
    String action = intent.getAction();

    if (SMS_SENT_ACTION.equals(action)) {
        SnippetEvent event = new SnippetEvent(mCallbackId, SMS_SENT_EVENT_NAME);
        switch (getResultCode()) {
            case Activity.RESULT_OK:
                if (mExpectedMessageCount == 1) {
                    event.getData().putBoolean("sent", true);
                    mEventCache.postEvent(event);
                    mContext.unregisterReceiver(this);
                }

                if (mExpectedMessageCount > 0) {
                    mExpectedMessageCount--;
                }
                break;
            case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
            case SmsManager.RESULT_ERROR_NO_SERVICE:
            case SmsManager.RESULT_ERROR_NULL_PDU:
            case SmsManager.RESULT_ERROR_RADIO_OFF:
                event.getData().putBoolean("sent", false);
                event.getData().putInt("error_code", getResultCode());
                mEventCache.postEvent(event);
                mContext.unregisterReceiver(this);
                break;
            default:
                event.getData().putBoolean("sent", false);
                event.getData().putInt("error_code", -1 /* Unknown */);
                mEventCache.postEvent(event);
                mContext.unregisterReceiver(this);
                break;
        }
    }
}
 
开发者ID:google,项目名称:mobly-bundled-snippets,代码行数:36,代码来源:SmsSnippet.java

示例12: onReceive

@Override
public void onReceive(Context context, Intent intent) {
    switch (getResultCode()){
        case Activity.RESULT_OK:
            Toast.makeText(context, context.getResources().getString(R.string.SMS_sent),
                    Toast.LENGTH_SHORT).show();
            Log.d(TAG, "SmsSentBroadcastReceiver: SMS has been sent");
            String phoneNumber = intent.getStringExtra(PHONE_NUMBER_EXTRA);
            String verificationCode = intent.getStringExtra(VERIFICATION_CODE_EXTRA);
            Log.d(TAG, "phoneNumber from intent: " + phoneNumber);
            Log.d(TAG, "verification code from intent: " + verificationCode);
            break;

        case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
            Toast.makeText(context, context.getResources().getString(R.string.generic_failure),
                    Toast.LENGTH_SHORT).show();
            Log.d(TAG, "SMS has not been sent, there was a generic failure");
            break;

        case SmsManager.RESULT_ERROR_NO_SERVICE:
            Toast.makeText(context, context.getResources().getString(R.string.no_service),
                    Toast.LENGTH_SHORT).show();
            Log.d(TAG, "SMS has not been sent, there is no service");
            break;

        case SmsManager.RESULT_ERROR_NULL_PDU:
            Toast.makeText(context, context.getResources().getString(R.string.null_pdu),
                    Toast.LENGTH_SHORT).show();
            Log.d(TAG, "SMS has not been sent, there is no PDU");
            break;

        case SmsManager.RESULT_ERROR_RADIO_OFF:
            Toast.makeText(context, context.getResources().getString(R.string.radio_off),
                    Toast.LENGTH_SHORT).show();
            Log.d(TAG, "SMS has not been sent, radio is off");
            break;
    }
}
 
开发者ID:VictorGil,项目名称:phoneVerifier,代码行数:38,代码来源:SmsSentBroadcastReceiver.java

示例13: lastSentSmsStatus

public HashMap<String, String> lastSentSmsStatus(){
    HashMap<String,String> ret = new HashMap<String,String>();
    switch (lastSentSMSStatus) {
        case Activity.RESULT_OK:
            ret.put("STATUS","SENT");
            break;
        case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
            ret.put("STATUS","ERROR");
            ret.put("DESCRIPTION","GENERIC");
            break;
        case SmsManager.RESULT_ERROR_NO_SERVICE:
            ret.put("STATUS","ERROR");
            ret.put("DESCRIPTION","NO SERVICE");
            break;
        case SmsManager.RESULT_ERROR_NULL_PDU:
            ret.put("STATUS","ERROR");
            ret.put("DESCRIPTION","NULL PDU");
            break;
        case SmsManager.RESULT_ERROR_RADIO_OFF:
            ret.put("STATUS","ERROR");
            ret.put("DESCRIPTION","RADIO OFF");
            break;
        default:
            ret.put("STATUS","UNKNOWN");
            break;
    }
    return ret;
}
 
开发者ID:strang3quark,项目名称:remotedroid,代码行数:28,代码来源:SMSUtils.java

示例14: handleSentResult

private void handleSentResult(MasterSecret masterSecret, long messageId, int result) {
  try {
    EncryptingSmsDatabase database = DatabaseFactory.getEncryptingSmsDatabase(context);
    SmsMessageRecord      record   = database.getMessage(masterSecret, messageId);

    switch (result) {
      case Activity.RESULT_OK:
        database.markAsSent(messageId);

        if (record != null && record.isEndSession()) {
          Log.w(TAG, "Ending session...");
          SessionStore sessionStore = new TextSecureSessionStore(context, masterSecret);
          sessionStore.deleteAllSessions(record.getIndividualRecipient().getRecipientId());
          SecurityEvent.broadcastSecurityUpdateEvent(context, record.getThreadId());
        }

        break;
      case SmsManager.RESULT_ERROR_NO_SERVICE:
      case SmsManager.RESULT_ERROR_RADIO_OFF:
        Log.w(TAG, "Service connectivity problem, requeuing...");
        ApplicationContext.getInstance(context)
            .getJobManager()
            .add(new SmsSendJob(context, messageId, record.getIndividualRecipient().getNumber()));

        break;
      default:
        database.markAsSentFailed(messageId);
        MessageNotifier.notifyMessageDeliveryFailed(context, record.getRecipients(), record.getThreadId());
    }
  } catch (NoSuchMessageException e) {
    Log.w(TAG, e);
  }
}
 
开发者ID:redcracker,项目名称:TextSecure,代码行数:33,代码来源:SmsSentJob.java

示例15: onReceive

@Override
public void onReceive(Context context, Intent intent) {
    if (intent.getAction().equals(SMS_SEND_ACTION)){
        switch (getResultCode()){
            case Activity.RESULT_OK:
                Toast.makeText(context, "发送成功", Toast.LENGTH_SHORT).show();
                break;
            case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
                Toast.makeText(context, "发送失败", Toast.LENGTH_SHORT).show();
                break;
            case SmsManager.RESULT_ERROR_RADIO_OFF:

                break;
            case SmsManager.RESULT_ERROR_NULL_PDU:

                break;
        }
    } else if (intent.getAction().equals(SMS_DELIVERED_ACTION)){
        switch (getResultCode()){
            case Activity.RESULT_OK:
                Toast.makeText(context, "短信已送达", Toast.LENGTH_SHORT).show();
                break;
            case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
                Toast.makeText(context, "短信未送达", Toast.LENGTH_SHORT).show();
                break;
            case SmsManager.RESULT_ERROR_RADIO_OFF:

                break;
            case SmsManager.RESULT_ERROR_NULL_PDU:

                break;
        }
    }
}
 
开发者ID:InnoFang,项目名称:AutoSMS,代码行数:34,代码来源:ReceiverService.java


注:本文中的android.telephony.SmsManager.RESULT_ERROR_RADIO_OFF属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。