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


Java SmsManager.RESULT_ERROR_NULL_PDU属性代码示例

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


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

示例1: 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

示例2: 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

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: onReceive

@Override
public void onReceive(Context context, Intent intent) {
    switch (getResultCode()) {
        case Activity.RESULT_OK:
            log.info("send SMS successful");
            break;
        case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
        case SmsManager.RESULT_ERROR_RADIO_OFF:
        case SmsManager.RESULT_ERROR_NULL_PDU:
            log.error("send SMS failed");
            break;
    }
}
 
开发者ID:chaincloud-dot-com,项目名称:chaincloud-v,代码行数:13,代码来源:SMSServiceBase.java

示例15: onReceive

@Override
public void onReceive(Context c, Intent intent) {
    final int result = getResultCode();
    final Uri uri = (Uri)intent.getParcelableExtra("uri");

    boolean resultOk = false;
    switch (result) {
        case Activity.RESULT_OK:
            Toast.makeText(c, R.string.msg_sms_confirm_sent, Toast.LENGTH_LONG).show();
            resultOk = true;
            break;

        case SmsManager.RESULT_ERROR_RADIO_OFF:
            Toast.makeText(c, c.getText(R.string.msg_sms_confirm_sent_error_radio_off), Toast.LENGTH_LONG).show();
            DebugLog.e("sms not sent because of RESULT_ERROR_RADIO_OFF");
            break;

        case SmsManager.RESULT_ERROR_NULL_PDU:
            Toast.makeText(c, c.getText(R.string.msg_sms_confirm_sent_error_null_pdu), Toast.LENGTH_LONG).show();
            DebugLog.e("sms not sent because of RESULT_ERROR_NULL_PDU");
            break;

        case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
            Toast.makeText(c, c.getText(R.string.msg_sms_confirm_sent_error_generic), Toast.LENGTH_LONG).show();
            DebugLog.e("sms not sent because of RESULT_ERROR_GENERIC_FAILURE");
            break;

        default:
            Toast.makeText(c, c.getText(R.string.msg_sms_confirm_sent_error_generic), Toast.LENGTH_LONG).show();
            DebugLog.e("sms not sent because of some other reason");
    }

    if (!resultOk) {
        if (uri != null) {
            c.getContentResolver().delete(uri, null, null);
        } else {
            DebugLog.w("Uri is null, something weird is going on");
        }
    }
}
 
开发者ID:avast,项目名称:sms-ticket,代码行数:40,代码来源:SmsConfirmationSent.java


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