由于没有用于发送短信的broadcastReceiver,我们需要定期轮询SMS内容提供商(内容://短信/发送),并提出一种方法来捕获消息的发送(onChange)。 这很容易!
棘手的一点是,它是否有可能(可能是一个巧妙的技巧,黑客,解决方案,甚至是现有系统中的漏洞),可以指示用户是手动发送短信还是由其他人自动发送已安装应用程序与后台服务或由某些意图触发的接收器!
说什么?可能的?
答案 0 :(得分:0)
如果您的应用正在发送短信,那么您可以获得短信已发送的状态,如下所示。由于您没有发送全球回拨短信未发送,您无法了解它。
/**
* Listen to Delivery Reports of sent SMSs
*/
private BroadcastReceiver mSmsDeliveryListener = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
try{
int result = getResultCode();
switch (result){
case Activity.RESULT_OK:
//SMS Delivered
break;
case Activity.RESULT_CANCELED:
case SmsManager.RESULT_ERROR_GENERIC_FAILURE:
case SmsManager.RESULT_ERROR_NO_SERVICE:
case SmsManager.RESULT_ERROR_NULL_PDU:
case SmsManager.RESULT_ERROR_RADIO_OFF:
//SMS Delivery failed
break;
default:
//SMS Delivery failed
break;
}
}//End of Switch
}catch (Exception e) {
e.printStackTrace();
}
}
};