我已经删除了我的旧答案,如果您仍然担心,可能会为您提供更多信息。
我发现我在一些但不是所有向我发送彩信的手机上遇到了非常相似的问题。好的,所以当我收到彩信时,您可以并且可能应该将某些内容发回给您发送消息的手机。
您发回的内容称为:“AcknowledgeInd”。 AcknowledgeInd 是一个公共类
扩展“GenericPdu”。这个 AcknowledgeInd 可以在网上找到,也可以在 Klinker Library 中找到。
如果您有兴趣,网上也有一些关于 AcknowledgeInd 实际是什么以及 ReadRecInd 和所有其他内容的非常枯燥乏味的官方资料。
您需要构建此 AcknowledgeInd 并将其发送回 Mms 消息给向您的设备发送消息的人。
构建确认信息:
ack_ind = new AcknowledgeInd(mms_version, pdu_trans_ID.getBytes());
return new PduComposer(application_context, ack_ind).make();
PduComposer.make() 返回一个字节[],然后你用它来发送彩信。
/*"mms_send_file" is created here and used only inside of sendMmsViaCarrier();
* It is then deleted inside handleSmsMmsSent() after the Mms has been sent whether
* successful or not*/
final String mms_file_name = "send." + String.valueOf(Math.abs(new Random().nextLong())) + ".dat";
File mms_follow_up_file = new File(application_context.getCacheDir(), mms_file_name);
FileOutputStream 字节[] 到“mms_follow_up_file”。
构建 Uri 以用作方法 sms_manager.sendMultimediaMessage() 中的参数。
Uri content_uri = (new Uri.Builder())
//.authority("com.example.android.apis.os.MmsFileProvider")
//.authority(getBaseContext().getPackageName() + ".MmsFileProvider")
.authority(application_context.getPackageName() + ".MmsFileProvider")
.path(mms_file_name)
.scheme(ContentResolver.SCHEME_CONTENT)
//.scheme(ContentResolver.SCHEME_FILE)
.build();
然后调用Android方法发送:
sms_manager.sendMultimediaMessage(application_context, content_uri, null, null, pending_intent_mms_follow_up);
注意事项:
对于这个 Mms 内容,始终使用“ApplicationContext”。
您将需要作为 NotificationInd 的一部分提供的“交易 ID”,它是 Android 在从您的清单接收器接收到广播时检索并提供给您的内容。