简体   繁体   English

Android:双SIM卡手机有哪些特定于供应商的方法可以检测用于短信的SIM卡?

[英]Android: what vendor-specific methods are known for dual-SIM phones to detect a SIM used for SMS?

It is known that Android's SMS is stored as: 众所周知,Android的短信存储为:

CREATE TABLE sms (_id INTEGER PRIMARY KEY,
   thread_id INTEGER,
   address TEXT,
   person INTEGER,
   date INTEGER,
   date_sent INTEGER DEFAULT 0,
   protocol INTEGER,
   read INTEGER DEFAULT 0,
   status INTEGER DEFAULT -1,
   type INTEGER,
   reply_path_present INTEGER,
   subject TEXT,
   body TEXT,
   service_center TEXT,
   locked INTEGER DEFAULT 0,
   error_code INTEGER DEFAULT 0,
   seen INTEGER DEFAULT 0
)

In a situation with dual-SIM phone, can it be expected that some of the parameters can be used to identify which SIM was used to send/receive SMS? 在使用双SIM卡电话的情况下,是否可以预期某些参数可用于识别哪个SIM用于发送/接收SMS?

Its known that person == NULL for outgoing SMS in normal case; 在正常情况下,已知person == NULL用于传出短信; it doesn't seems that my dual-sim MTK phone has any tendency to remember from which SIM a message was sent in conversation (that's how I replyleaked my work number to friends once...) . 我的双卡MTK手机似乎没有任何倾向记住在会话中发送消息的SIM卡(这就是我如何回复我的工作号码给朋友一次......)

Also, I guess there's still only one SMS content folder (or else a severe compatibility problems will come), and ContentValues seemingly can't store much data too. 此外,我猜仍然只有一个SMS内容文件夹(否则会出现严重的兼容性问题),而且ContentValues似乎也无法存储太多数据。

But, I still want to support both HTC's and MTK's dual sim solutions; 但是,我仍然想支持HTC和MTK的双卡解决方案; what are most known ways to associate incoming/outgoing SMS with a SIM #? 将传入/传出SMS与SIM#相关联的最常用方法是什么? How to get sender # for outgoing SMS and get receive path number for incoming? 如何为发送短信获取发送方#并获取接收的接收路径号?


PS "Service center #" is known but rejected solution - I do own two SIMs from one operator in one phone.. PS“服务中心#”已知但拒绝解决方案 - 我在一部手机中拥有一个操作员的两个SIM卡。

I would suggest: 我会建议:

1 - build a message app that supports dual sim device. 1 - 构建支持双SIM卡设备的消息应用程序。 its important to let user make this app as default . 让用户将此应用程序设为默认值非常重要。 because from Android 19 ( Kitkat ) only default message app can access db. 因为从Android 19(Kitkat)只有默认消息应用程序才能访问db。

2 - use this way to manage which SIM to use for sending message. 2 - 使用这种方式管理用于发送消息的SIM。 https://stackoverflow.com/a/30677542/2267723 https://stackoverflow.com/a/30677542/2267723

3 - implicitly that means your app is for storing data to database for incoming/outgoing/sent messages (SMS/MMS). 3 - 隐含地表示您的应用程序用于将数据存储到数据库以用于传入/传出/发送消息(SMS / MMS)。 so of you know which sim is used by#2, then store sim_ID in DB. 所以你知道#2使用了哪个sim,然后将sim_ID存储在DB中。 later you can use it to know which sim managed that message. 稍后您可以使用它来了解管理该消息的SIM卡。

在此输入图像描述

A hint: It'd be better to store the ID of SIM ( IMSI / subscriberID) or you can use serialNumer of SIM card to identify SIM, in app if that ID belongs to inserted SIM, then you can refer to message as SIM1 or SIM2 message. 提示:最好存储SIM的ID(IMSI / subscriberID),或者您可以使用SIM卡的serialNumer来识别SIM,如果该ID属于插入的SIM卡,那么您可以将消息称为SIM1或SIM2消息。 otherwise keep message independently from SIM slots ... its not recommended to store message with values 0/1 or 1/2 as identifiers for used sim. 否则独立于SIM卡插槽保留消息...不建议将值为0/1或1/2的消息存储为已使用SIM卡的标识符。 because if user changes SIMs or switches them .. there will be a conflict. 因为如果用户更改SIM或切换它们,则会发生冲突。 and you can see its a broken design. 你可以看到它破碎的设计。

Good luck, 祝好运,

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM