短信发送或取消时收到通知?

Get Notified When SMS is sent or cancelled?

我的应用每天只能使用默认短信发送器 (已存在于每个 android 设备中) 发送一条短信,因此,发送短信后,我需要禁用发送短信按钮。

我目前正在做的是,每当用户点击发送短信按钮时,我都会像这样将他导航到设备默认消息发件人,

        Intent intent = new Intent(Intent.ACTION_VIEW, Uri.fromParts("sms", phoneNumber, null));
        intent.putExtra("sms_body", message);
        baseActivity.startActivity(intent);

我只能将用户导航到默认的 SMS 发件人,然后用户可以从那里发送 SMS,也可以取消发送 SMS (通过按后退按钮),现在问题是如何通知我短信已发送?是否有任何回调或接收机制可以告诉我短信已发送或用户取消了短信?

which is already present in every android device

不是真的。

I navigate him to the device default message sender like this,

Android 设备不要求应用程序响应 sms 方案的 ACTION_VIEWACTION_SEND 你会有更好的机会,因为 that is what Google says that you should use.

即便如此,也会有设备缺少此类应用程序。例如,并非所有 Android 设备都是手机。

how will I be notified that the SMS is sent?

你不会的。用户如何响应您的 ACTION_VIEW(或 ACTION_SENDACTION_SENDTOACTION_SEND_MULTIPLE)请求取决于用户和用户选择的应用程序。

Is there any callback or receiver mechanism which can tell me that the SMS was sent or SMS was canceled by the user?

不是真的。对于初学者,用户可能不会选择 SMS 客户端来响应您的 Intent。毕竟,任何应用程序都可以有一个 activity 来响应您的 Intent 结构。即使用户选择 SMS 客户端,也不能保证该应用程序会执行任何允许第三方(例如您的应用程序)了解该应用程序内部发生的事情。

许多(但不是全部)SMS 客户端将使用已发送的项目更新提供给 Sms 内容提供商的系统。