获得从进来的消息中的IMSI号码或者目的地电话号码(SMS)的电话号码、目的地、号码、消息

2023-09-07 23:53:40 作者:从此长居我心好吗

我开发,需要所述设备的IMSI /电话号码(多个SIM卡),其接收的SMS应用

I am developing an application that requires the IMSI/phone number of the device(with multiple SIM cards) which receives an sms.

这基本上是为识别目的的SIM卡接收到短信,以后再执行进一步的操作。

This is basically for identification purpose of which SIM is receiving the sms and later perform further operations.

我已经彻底搜查了SMSMessage的API,但没有找到合适的解决方案。

I have thoroughly searched the SMSMessage Api, but did not find a suitable solution.

任何帮助将是很大的AP preciated。

Any help would be greatly appreciated.

推荐答案

据我所知,你不能让目的地的电话号码,IMSI从收到的短信。

As I know you can not get the destination phone number, IMSI from the incoming SMS.

您可以得到SIM卡的IMSI和电话号码这样的方式。

You can get the IMSI and phone Number of SIM like this way.

您可以得到SIM卡的IMSI号码,但我不认为你可以得到所有SIM卡的电话号码,因为一些制造没有保存在SIM卡的电话号码,所以你会得到空。

You can get the IMSI number of SIM but I don't think you will be able to get the phone number of all SIM because some manufacture did not save the phone number in SIM so you will get the NULL.

在Android的,没办法使用Android SDK中获得第二SIM信息。你可以只得到第一个SIM卡的信息。

In Android, No way using Android SDK to get the second SIM information. You can get the information of first SIM only.

Android的SDK支持第一SIM信息和双卡双待功能,可从生产端,因此没有正式从Android SDK中。

Android SDK support the first SIM information and Dual SIM features are available from manufacture side hence not officially supported from Android SDK.

将此AndroidManifest.xml中

Add this AndroidManifest.xml

<uses-permission android:name="android.permission.READ_PHONE_STATE"/>

在你想获得SIM卡的详细信息添加此。

Add this in where you want to get SIM details.

TelephonyManager telemamanger = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);

要获得第一个SIM卡的IMSI

To get the IMSI of 1st SIM

String imsi = telemamanger.getSimSerialNumber();

要获得第一个SIM卡的电话号码

To get the Phone Number of 1st SIM

if(telemamanger.getLine1Number() != null)
    String phoneNumber = telemamanger.getLine1Number();