我们在 Android 上使用 SMSManager 从设备向其他人发送短信。
我们有报告称用户没有收到我们认为已发送的短信,因为 sentIntent 已被 Activity.RESULT_OK 调用 - 但当本地短信服务只是将消息排队等待发送时,这似乎发生了,而不一定是当它真正发送时。
所以我认为我们应该使用deliveryIntent。
这里的问题是我总是收到 sentIntent 回调,但从来没有收到 deliveryIntent 回调。
有任何想法吗?代码如下,谢谢。
// The intent action to be unique so that we can have multiple
// concurrent pending intents.
// http://developer.android.com/reference/android/app/PendingIntent.html
String intentAction = TAG + "-" + callbackId; // callbackId is unique
Intent intent = new Intent(intentAction);
intent.putExtra("phoneNumber", phoneNumber);
intent.putExtra("callbackId", callbackId);
intent.putExtra("message", message);
PendingIntent sentPI = PendingIntent.getBroadcast(
cordova.getActivity(), 0, intent, 0);
cordova.getActivity().registerReceiver(new BroadcastReceiver() {
@Override
public void onReceive(Context ctx, Intent intent) { …Run Code Online (Sandbox Code Playgroud)