Android 双卡双待发送短信

Android 双卡识别Imsi以及副卡发送短信总结 Android5.0系统才开始提供对双卡识别支持,提供SubscriptionManager类来完成对双卡相关设备信息的读取。在5.0之前只能根据机型来适配来获取副卡Imsi,本文重点介绍5.0之后的Api以及适配。 阅读详情
就
17 down vote accepted

I use this way to manage which sim to use for sending SMS even long message .. Its working on my dual sim phone Lenovo A319 (4.4.3), no need for root. its built on reflection.

import android.app.PendingIntent;
import android.content.Context;
import android.os.Build;
import android.os.IBinder;
import android.util.Log;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Apipas on 6/4/15.
 */
public class SimUtil {

    public static boolean sendSMS(Context ctx, int simID, String toNum, String centerNum, String smsText, PendingIntent sentIntent, PendingIntent deliveryIntent) {
        String name;

        try {
            if (simID == 0) {
                name = "isms";
                // for model : "Philips T939" name = "isms0"
            } else if (simID == 1) {
                name = "isms2";
            } else {
                throw new Exception("can not get service which for sim '" + simID + "', only 0,1 accepted as values");
            }
            Method method = Class.forName("android.os.ServiceManager").getDeclaredMethod("getService", String.class);
            method.setAccessible(true);
            Object param = method.invoke(null, name);

            method = Class.forName("com.android.internal.telephony.ISms$Stub").getDeclaredMethod("asInterface", IBinder.class);
            method.setAccessible(true);
            Object stubObj = method.invoke(null, param);
            if (Build.VERSION.SDK_INT < 18) {
                method = stubObj.getClass().getMethod("sendText", String.class, String.class, String.class, PendingIntent.class, PendingIntent.class);
                method.invoke(stubObj, toNum, centerNum, smsText, sentIntent, deliveryIntent);
            } else {
                method = stubObj.getClass().getMethod("sendText", String.class, String.class, String.class, String.class, PendingIntent.class, PendingIntent.class);
                method.invoke(stubObj, ctx.getPackageName(), toNum, centerNum, smsText, sentIntent, deliveryIntent);
            }

            return true;
        } catch (ClassNotFoundException e) {
            Log.e("apipas", "ClassNotFoundException:" + e.getMessage());
        } catch (NoSuchMethodException e) {
            Log.e("apipas", "NoSuchMethodException:" + e.getMessage());
        } catch (InvocationTargetException e) {
            Log.e("apipas", "InvocationTargetException:" + e.getMessage());
        } catch (IllegalAccessException e) {
            Log.e("apipas", "IllegalAccessException:" + e.getMessage());
        } catch (Exception e) {
            Log.e("apipas", "Exception:" + e.getMessage());
        }
        return false;
    }


    public static boolean sendMultipartTextSMS(Context ctx, int simID, String toNum, String centerNum, ArrayList<String> smsTextlist, ArrayList<PendingIntent> sentIntentList, ArrayList<PendingIntent> deliveryIntentList) {
        String name;
        try {
            if (simID == 0) {
                name = "isms";
                // for model : "Philips T939" name = "isms0"
            } else if (simID == 1) {
                name = "isms2";
            } else {
                throw new Exception("can not get service which for sim '" + simID + "', only 0,1 accepted as values");
            }
            Method method = Class.forName("android.os.ServiceManager").getDeclaredMethod("getService", String.class);
            method.setAccessible(true);
            Object param = method.invoke(null, name);

            method = Class.forName("com.android.internal.telephony.ISms$Stub").getDeclaredMethod("asInterface", IBinder.class);
            method.setAccessible(true);
            Object stubObj = method.invoke(null, param);
            if (Build.VERSION.SDK_INT < 18) {
                method = stubObj.getClass().getMethod("sendMultipartText", String.class, String.class, List.class, List.class, List.class);
                method.invoke(stubObj, toNum, centerNum, smsTextlist, sentIntentList, deliveryIntentList);
            } else {
                method = stubObj.getClass().getMethod("sendMultipartText", String.class, String.class, String.class, List.class, List.class, List.class);
                method.invoke(stubObj, ctx.getPackageName(), toNum, centerNum, smsTextlist, sentIntentList, deliveryIntentList);
            }
            return true;
        } catch (ClassNotFoundException e) {
            Log.e("apipas", "ClassNotFoundException:" + e.getMessage());
        } catch (NoSuchMethodException e) {
            Log.e("apipas", "NoSuchMethodException:" + e.getMessage());
        } catch (InvocationTargetException e) {
            Log.e("apipas", "InvocationTargetException:" + e.getMessage());
        } catch (IllegalAccessException e) {
            Log.e("apipas", "IllegalAccessException:" + e.getMessage());
        } catch (Exception e) {
            Log.e("apipas", "Exception:" + e.getMessage());
        }
        return false;
    }


}

Add permission:

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

then just call that (bloody) static method like this :) 

To use SIM1:

SimUtil.sendSMS(this,0,"00970XXXXXXXXX",null,"Hi Stackoverflow! its me Maher. Sent by sim1",null,null);

To use SIM2:

SimUtil.sendSMS(this,1,"00970XXXXXXXXX",null,"Hi Stackoverflow! its me Maher. Sent by sim2",null,null);

But wait...that won't work if message is longer than 160 characters.. so better way:

String textSMS;
//short <160
//    textSMS = "Hi Stackoverflow! its me Maher.";


//long >160
textSMS = "Hi Jerusalem, hi Cairo, Hi Prague, hi Baghdad, hi Riyadh, hi Jeddah, hi Dammam, hi Aleppo, hi Casablanca, hi Damascus, hi Alexandria, hi Algiers, hi Mosul, hi Basra, hi Arabia, hi Tripoli, hi Amman, hi Kuwait, hi Beirut, hi Abu Dhabi";

int simID = 0;//0:sim_1,   1:sim_2

ArrayList<String> messageList = SmsManager.getDefault().divideMessage(textSMS);
if (messageList.size() > 1) {
    SimUtil.sendMultipartTextSMS(this, simID, "00972XXXXXXXXX", null, messageList, null, null);
} else {
    SimUtil.sendSMS(this, simID, "00972XXXXXXXXX", null, textSMS, null, null);
}

so you can safely pass message body without worrying about length.

------------------ Extra ------------------

I have seen that Android 22 supports multi sim cards from Android 5.1 and here is how to use it .. unfortunately I don't have device with that version for testing, so please for feedback:

SmsManager.getSmsManagerForSubscriptionId(int subscriptionId).sendTextMessage(String destinationAddress, String scAddress, String text,PendingIntent sentIntent, PendingIntent deliveryIntent);

How to get subscriptionId? to review all available subscriptionID that belong to sim card:

SubscriptionManager subscriptionManager = SubscriptionManager.from(getApplicationContext());
        List<SubscriptionInfo> subscriptionInfoList = subscriptionManager.getActiveSubscriptionInfoList();
        for (SubscriptionInfo subscriptionInfo : subscriptionInfoList) {
            int subscriptionId = subscriptionInfo.getSubscriptionId();
            Log.d("apipas","subscriptionId:"+subscriptionId);
        }

** Please note that this code is working on 5.1. if you try to run it on older version you'd get an exception that method doesn't exist.

------------UPDATE 19.8.2015----------

Information on SIMs, are located in DB: telephony.db (by default: /data/data/com.android.providers.telephony/databases/telephony.db ) in table siminfo. See screenshot on table siminfo in DB on real device.

enter image description here

Fortunately there is a content provider for that: 

"content://telephony/siminfo/"

So basically just query data from that table.Its important to mention that slot 0 represents SIM1, and 1 represents SIM2, and slot -1 from old/removed/replaced SIMs.

This applies on Lenovo A319 . I guess that may work on other devices. Here is the util method I use: 

public static List<SimInfo> getSIMInfo(Context context) {
        List<SimInfo> simInfoList = new ArrayList<>();
        Uri URI_TELEPHONY = Uri.parse("content://telephony/siminfo/");
        Cursor c = context.getContentResolver().query(URI_TELEPHONY, null, null, null, null);
        if (c.moveToFirst()) {
            do {
                int id = c.getInt(c.getColumnIndex("_id"));
                int slot = c.getInt(c.getColumnIndex("slot"));
                String display_name = c.getString(c.getColumnIndex("display_name"));
                String icc_id = c.getString(c.getColumnIndex("icc_id"));
                SimInfo simInfo = new SimInfo(id, display_name, icc_id, slot);
                Log.d("apipas_sim_info", simInfo.toString());
                simInfoList.add(simInfo);
            } while (c.moveToNext());
        }
        c.close();

        return simInfoList;
    }

and here is the entity class SimInfo:

public class SimInfo {
    private int id_;
    private String display_name;
    private String icc_id;
    private int slot;

    public SimInfo(int id_, String display_name, String icc_id, int slot) {
        this.id_ = id_;
        this.display_name = display_name;
        this.icc_id = icc_id;
        this.slot = slot;
    }

    public int getId_() {
        return id_;
    }

    public String getDisplay_name() {
        return display_name;
    }

    public String getIcc_id() {
        return icc_id;
    }

    public int getSlot() {
        return slot;
    }

    @Override
    public String toString() {
        return "SimInfo{" +
                "id_=" + id_ +
                ", display_name='" + display_name + '\'' +
                ", icc_id='" + icc_id + '\'' +
                ", slot=" + slot +
                '}';
    }
}

Good luck,'.

share improve this answer
 
1 
Great but how can i get information about sim1 and sim2 ? I want to send text using specific operator only, lets say AT&T. do you have any idea how to find out information about each sim card? –  Alireza  Aug 18 '15 at 11:24
1 
Hi Alireza, see my updated answer. I included util I use for that purpose. –  Maher Abuthraa  Aug 19 '15 at 8:06
 
thank you very much i will definitely give it a try. –  Alireza  Aug 20 '15 at 8:54
 
when i tried this one.. sms is sending only sim1 only.. can u give any overall working source code pls –  harikrishnan  Jun 22 at 9:22
 
@harikrishnan, pass 1 as parameter for simID to be able to send message via Sim2, since 0:sim1, sim2:1 ... you have same source code I have .. there is no more code related to dual-sim sms-ing –  Maher Abuthraa Jun 29 at 21:34
17 down vote accepted

I use this way to manage which sim to use for sending SMS even long message .. Its working on my dual sim phone Lenovo A319 (4.4.3), no need for root. its built on reflection.

import android.app.PendingIntent;
import android.content.Context;
import android.os.Build;
import android.os.IBinder;
import android.util.Log;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;

/**
 * Created by Apipas on 6/4/15.
 */
public class SimUtil {

    public static boolean sendSMS(Context ctx, int simID, String toNum, String centerNum, String smsText, PendingIntent sentIntent, PendingIntent deliveryIntent) {
        String name;

        try {
            if (simID == 0) {
                name = "isms";
                // for model : "Philips T939" name = "isms0"
            } else if (simID == 1) {
                name = "isms2";
            } else {
                throw new Exception("can not get service which for sim '" + simID + "', only 0,1 accepted as values");
            }
            Method method = Class.forName("android.os.ServiceManager").getDeclaredMethod("getService", String.class);
            method.setAccessible(true);
            Object param = method.invoke(null, name);

            method = Class.forName("com.android.internal.telephony.ISms$Stub").getDeclaredMethod("asInterface", IBinder.class);
            method.setAccessible(true);
            Object stubObj = method.invoke(null, param);
            if (Build.VERSION.SDK_INT < 18) {
                method = stubObj.getClass().getMethod("sendText", String.class, String.class, String.class, PendingIntent.class, PendingIntent.class);
                method.invoke(stubObj, toNum, centerNum, smsText, sentIntent, deliveryIntent);
            } else {
                method = stubObj.getClass().getMethod("sendText", String.class, String.class, String.class, String.class, PendingIntent.class, PendingIntent.class);
                method.invoke(stubObj, ctx.getPackageName(), toNum, centerNum, smsText, sentIntent, deliveryIntent);
            }

            return true;
        } catch (ClassNotFoundException e) {
            Log.e("apipas", "ClassNotFoundException:" + e.getMessage());
        } catch (NoSuchMethodException e) {
            Log.e("apipas", "NoSuchMethodException:" + e.getMessage());
        } catch (InvocationTargetException e) {
            Log.e("apipas", "InvocationTargetException:" + e.getMessage());
        } catch (IllegalAccessException e) {
            Log.e("apipas", "IllegalAccessException:" + e.getMessage());
        } catch (Exception e) {
            Log.e("apipas", "Exception:" + e.getMessage());
        }
        return false;
    }


    public static boolean sendMultipartTextSMS(Context ctx, int simID, String toNum, String centerNum, ArrayList<String> smsTextlist, ArrayList<PendingIntent> sentIntentList, ArrayList<PendingIntent> deliveryIntentList) {
        String name;
        try {
            if (simID == 0) {
                name = "isms";
                // for model : "Philips T939" name = "isms0"
            } else if (simID == 1) {
                name = "isms2";
            } else {
                throw new Exception("can not get service which for sim '" + simID + "', only 0,1 accepted as values");
            }
            Method method = Class.forName("android.os.ServiceManager").getDeclaredMethod("getService", String.class);
            method.setAccessible(true);
            Object param = method.invoke(null, name);

            method = Class.forName("com.android.internal.telephony.ISms$Stub").getDeclaredMethod("asInterface", IBinder.class);
            method.setAccessible(true);
            Object stubObj = method.invoke(null, param);
            if (Build.VERSION.SDK_INT < 18) {
                method = stubObj.getClass().getMethod("sendMultipartText", String.class, String.class, List.class, List.class, List.class);
                method.invoke(stubObj, toNum, centerNum, smsTextlist, sentIntentList, deliveryIntentList);
            } else {
                method = stubObj.getClass().getMethod("sendMultipartText", String.class, String.class, String.class, List.class, List.class, List.class);
                method.invoke(stubObj, ctx.getPackageName(), toNum, centerNum, smsTextlist, sentIntentList, deliveryIntentList);
            }
            return true;
        } catch (ClassNotFoundException e) {
            Log.e("apipas", "ClassNotFoundException:" + e.getMessage());
        } catch (NoSuchMethodException e) {
            Log.e("apipas", "NoSuchMethodException:" + e.getMessage());
        } catch (InvocationTargetException e) {
            Log.e("apipas", "InvocationTargetException:" + e.getMessage());
        } catch (IllegalAccessException e) {
            Log.e("apipas", "IllegalAccessException:" + e.getMessage());
        } catch (Exception e) {
            Log.e("apipas", "Exception:" + e.getMessage());
        }
        return false;
    }


}

Add permission:

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

then just call that (bloody) static method like this :) 

To use SIM1:

SimUtil.sendSMS(this,0,"00970XXXXXXXXX",null,"Hi Stackoverflow! its me Maher. Sent by sim1",null,null);

To use SIM2:

SimUtil.sendSMS(this,1,"00970XXXXXXXXX",null,"Hi Stackoverflow! its me Maher. Sent by sim2",null,null);

But wait...that won't work if message is longer than 160 characters.. so better way:

String textSMS;
//short <160
//    textSMS = "Hi Stackoverflow! its me Maher.";


//long >160
textSMS = "Hi Jerusalem, hi Cairo, Hi Prague, hi Baghdad, hi Riyadh, hi Jeddah, hi Dammam, hi Aleppo, hi Casablanca, hi Damascus, hi Alexandria, hi Algiers, hi Mosul, hi Basra, hi Arabia, hi Tripoli, hi Amman, hi Kuwait, hi Beirut, hi Abu Dhabi";

int simID = 0;//0:sim_1,   1:sim_2

ArrayList<String> messageList = SmsManager.getDefault().divideMessage(textSMS);
if (messageList.size() > 1) {
    SimUtil.sendMultipartTextSMS(this, simID, "00972XXXXXXXXX", null, messageList, null, null);
} else {
    SimUtil.sendSMS(this, simID, "00972XXXXXXXXX", null, textSMS, null, null);
}

so you can safely pass message body without worrying about length.

------------------ Extra ------------------

I have seen that Android 22 supports multi sim cards from Android 5.1 and here is how to use it .. unfortunately I don't have device with that version for testing, so please for feedback:

SmsManager.getSmsManagerForSubscriptionId(int subscriptionId).sendTextMessage(String destinationAddress, String scAddress, String text,PendingIntent sentIntent, PendingIntent deliveryIntent);

How to get subscriptionId? to review all available subscriptionID that belong to sim card:

SubscriptionManager subscriptionManager = SubscriptionManager.from(getApplicationContext());
        List<SubscriptionInfo> subscriptionInfoList = subscriptionManager.getActiveSubscriptionInfoList();
        for (SubscriptionInfo subscriptionInfo : subscriptionInfoList) {
            int subscriptionId = subscriptionInfo.getSubscriptionId();
            Log.d("apipas","subscriptionId:"+subscriptionId);
        }

** Please note that this code is working on 5.1. if you try to run it on older version you'd get an exception that method doesn't exist.

------------UPDATE 19.8.2015----------

Information on SIMs, are located in DB: telephony.db (by default: /data/data/com.android.providers.telephony/databases/telephony.db ) in table siminfo. See screenshot on table siminfo in DB on real device.

enter image description here

Fortunately there is a content provider for that: 

"content://telephony/siminfo/"

So basically just query data from that table.Its important to mention that slot 0 represents SIM1, and 1 represents SIM2, and slot -1 from old/removed/replaced SIMs.

This applies on Lenovo A319 . I guess that may work on other devices. Here is the util method I use: 

public static List<SimInfo> getSIMInfo(Context context) {
        List<SimInfo> simInfoList = new ArrayList<>();
        Uri URI_TELEPHONY = Uri.parse("content://telephony/siminfo/");
        Cursor c = context.getContentResolver().query(URI_TELEPHONY, null, null, null, null);
        if (c.moveToFirst()) {
            do {
                int id = c.getInt(c.getColumnIndex("_id"));
                int slot = c.getInt(c.getColumnIndex("slot"));
                String display_name = c.getString(c.getColumnIndex("display_name"));
                String icc_id = c.getString(c.getColumnIndex("icc_id"));
                SimInfo simInfo = new SimInfo(id, display_name, icc_id, slot);
                Log.d("apipas_sim_info", simInfo.toString());
                simInfoList.add(simInfo);
            } while (c.moveToNext());
        }
        c.close();

        return simInfoList;
    }

and here is the entity class SimInfo:

public class SimInfo {
    private int id_;
    private String display_name;
    private String icc_id;
    private int slot;

    public SimInfo(int id_, String display_name, String icc_id, int slot) {
        this.id_ = id_;
        this.display_name = display_name;
        this.icc_id = icc_id;
        this.slot = slot;
    }

    public int getId_() {
        return id_;
    }

    public String getDisplay_name() {
        return display_name;
    }

    public String getIcc_id() {
        return icc_id;
    }

    public int getSlot() {
        return slot;
    }

    @Override
    public String toString() {
        return "SimInfo{" +
                "id_=" + id_ +
                ", display_name='" + display_name + '\'' +
                ", icc_id='" + icc_id + '\'' +
                ", slot=" + slot +
                '}';
    }
}

Good luck,'.

share improve this answer
 
1 
Great but how can i get information about sim1 and sim2 ? I want to send text using specific operator only, lets say AT&T. do you have any idea how to find out information about each sim card? –  Alireza  Aug 18 '15 at 11:24
1 
Hi Alireza, see my updated answer. I included util I use for that purpose. –  Maher Abuthraa  Aug 19 '15 at 8:06
   
thank you very much i will definitely give it a try. –  Alireza  Aug 20 '15 at 8:54
   
when i tried this one.. sms is sending only sim1 only.. can u give any overall working source code pls –  harikrishnan  Jun 22 at 9:22
   
@harikrishnan, pass 1 as parameter for simID to be able to send message via Sim2, since 0:sim1, sim2:1 ... you have same source code I have .. there is no more code related to dual-sim sms-ing –  Maher Abuthraa Jun 29 at 21:34
uniapp [全端兼容] - 实现连接蓝牙电子秤+监听数据转换并实时返回示例代码,uniApp实现BLE蓝牙连接多个电子秤设备、蓝牙通讯协议对接详细教程(全平台兼容H5、微信小程序、苹果安卓App) uniapp连接蓝牙电子秤,uniapp如何连接电子秤蓝牙,蓝牙称重,实现监听数据转换并实时返回,多蓝牙,uni-app电子秤16进制蓝牙通讯协议对接,uniapp微信小程序蓝牙获取电子秤的值,uniapp蓝牙称重电子秤,蓝牙电子秤硬件,APP端连接蓝牙秤获取重量实时显示在页面上蓝牙秤,插件组件,蓝牙连接失败,uniapp安卓苹果ios连接蓝牙电子秤没反应,uniapp微信小程序 蓝牙低功耗连接发送数据监听接收,uni-app小程序蓝牙连接、读写数据全过程,uniapp连接蓝牙体脂秤,蓝牙搜索不到怎么办,如 阅读详情

相关推荐

Cadence PCB SI仿真实战:如何手动添加VIA过孔模型提升板级链路精度

本文详细介绍了在Cadence PCB SI仿真中如何手动添加VIA过孔模型以提升DDR4/5设计的精度。通过参数化建模和三维全波建模技术,工程师可以有效解决高速设计中的信号完整性问题,显著降低仿真误差。文章还提供了实战案例和常见问题解决方案,帮助优化板级链路性能。

weixin_28683391的博客 406

Android 5.0 双卡信息管理分析

    首先,如前面的博文所讲的,Android5.0开始支持双卡了。另外,对于双卡的卡信息的管理,也有了实现,尽管还不是完全彻底完整,如卡的slot id, display name,iccid,color等,其设计思路竟然跟之前接触到的一个平台是一样的,都是同不同颜色来标识不同的卡,让用户一目了然,只是5.0的实现目前还局限在FW框架里,应用层的实现还没有,相信,等到5.1或者再之后的版本中,...

weixin_33762321的博客 283

从零开始:用Kimi API和LangChain打造智能写作助手

本文详细介绍了如何从零开始,利用Kimi API提供的强大AI大模型能力,结合LangChain框架构建一个智能写作助手。通过实战演示了环境搭建、核心写作链构建、以及引入检索增强生成和智能体等进阶功能,旨在解决长文档创作、事实准确性等痛点,打造一个能理解意图、调用工具并保持记忆的智能创作伙伴。

weixin_29294395的博客 138

获取SIM卡唯一标识

获取双卡IMSI 唯一标识 Android 5.0之后google提供了双卡服务,在很多场景下我们的程序需要绑定sim卡的唯一标识,由于5.0以下谷歌不支持双卡,所以只有一个获取默认主卡的方法。 方法如下: tManager.getSubscriberId(); 接下来介绍如何获取双卡的唯一标志IMSI 第一种方法: public static String getPhoneImsiNum(Co

dong5488的专栏 1万+

Vivado ILA抓不到低频信号?试试Capture Control模式,保姆级配置教程(附PWM调试实例)

本文详细解析了Vivado ILA的Capture Control模式在低频信号捕获中的应用,特别针对PWM调试等场景提供保姆级配置教程。通过条件采样和时间拉伸技术,有效解决传统ILA采样在低频信号调试中的存储深度不足、关键信号丢失等问题,并附赠呼吸灯PWM的完整调试实例,帮助FPGA开发者提升调试效率。

weixin_42549451的博客 349

WorldPop数据集

WorldPop数据集介绍

qq_43874102的博客 1万+

双卡双待(一)

前言:关于双卡双待这个问题,调研了几个月终于有所进展,通过收集各方面的资料,整理出了这个文档。要说,双卡双待这玩意也只有国内手机才有,google爸爸才不会做呢~~╭(╯^╰)╮1.获取双卡的subId方法1:/** * @param slotId:卡槽的序号:0代表卡槽1,1代表卡槽2 * @param context:上下文 * @return:subId(可以理解

yanerly的博客 1365

从理论到板级:FOC电机驱动硬件电路全链路设计解析

本文从硬件工程师视角,深度解析FOC电机驱动从理论到板级实现的全链路设计。重点剖析了电源保护、核心采样电路、三相逆变桥与驱动电路等关键硬件模块的设计要点与实战经验,强调硬件是FOC算法可靠运行的基石,并提供了PCB布局布线的核心原则,帮助开发者构建高性能、高可靠性的电机驱动硬件平台。

weixin_29240711的博客 332

Android service命令

介绍 service命令用来查询某一个服务是否启动,以及调用某一个服务中的一个方法。 使用说明 #service Usage: service [-h|-?] service list service check SERVICE service call SERVICE CODE [i32 N | i64 N | f N | d N | s16 STR ] ... Options: i32: Write the 32-bit integer N in

zhujm320的专栏 1437

【100%通过率】2023华为od机试C卷【电脑病毒感染】C语言 实现

一个局域网内有很多台电脑,分别标注为 0 ~ N-1 的数字。相连接的电脑距离不一样,所以感染时间不一样,感染时间用t 表示。其中网络内一台电脑被病毒感染,求其感染网络内所有的电脑最少需要多长时间。如果最后有电脑不会感染,则返回-1.

MISAYAONE的博客 1042

QT实现ftp服务器(附完整源码)

QT实现ftp服务器(附完整源码)

希望我的博客,能帮上你解决学习中工作中所遇到的问题 1783

Android双卡识别IMSI以及副卡发送短信总结

今日科技快讯 有消息称,许多乐视员工的建行龙卡信用卡额度都被调整为1元,建设银行官方给出的理由为“涉及经济案件”。甚至3年前曾服务于乐视的员工,其建行信用卡额度也被调成了1元,这位前乐视员工投诉后建行回应:“该卡留的资料是在乐视,也是为了规避风险

郭霖 2852

OpenAI Function Calling 实战:让 Agent 自动调用外部 API 接口

在 2023 年 6 月之前,大语言模型(LLM)的能力边界是清晰的:它能说会道,能写诗作赋,也能帮你润色文案。但如果你问它"北京现在天气怎么样",它要么答不上来,要么基于过时的训练数据给你一个错误答案。原因很简单——LLM 的训练数据是有截止日期的,它活在"过去"。2023 年 6 月,OpenAI 在 GPT-4 的更新中引入了 Function Calling 功能,彻底改变了这一局面。Function Calling(也叫 Tool Use 或工具调用)是一种让 LLM 与外部系统交互的机制。

2201_76125393的博客 86

android 双卡双待 发送短信

最近公司拿了一批手机是FRG83G的双卡机子,在程序中按照普通的发短信调用方法,短信发不出去,经过研究,目前android的双卡手机有两个插槽,一个是GSM,另外一个是CDMA,对应的卡也必须插正确,否则无法使用。 Class smsManagerClass = null; Class[] divideMessagePamas = { String.class }; Clas

AresCJ的专栏 1万+

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

IDEA的使用指南

IDEA基于java的使用手册,可以最快速的上手,在使用中不断的丰富自己的使用技巧.

Android 双卡发送短信

Adnroid双卡手机发送短信

lmf0421的专栏 3611

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

uni-app 实战:Android 双卡短信发送、模板管理与系统短信兜底

摘要:uni-app实现Android双卡短信发送与模板管理 本文介绍了基于uni-app实现Android双卡短信发送功能的完整方案。系统包含短信模板管理(获取、保存、删除模板)、双卡信息识别(获取卡槽信息、SIM卡号码)、短信发送能力(权限校验、指定SIM卡发送、系统短信降级)三大核心模块。文章详细阐述了标准化模板数据结构、双卡设备识别逻辑,以及如何通过统一工具模块封装短信相关能力,实现页面和组件的复用。该方案特别针对CRM移动端需求设计,支持双卡选择、模板替换、权限校验和发送失败降级等业务场景。

lee_4524682的博客 195

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

android sim卡 信息,android-如何使用SIM2或双SIM卡提交短信

我创建了Android短信应用程序我已经能够顺利发送短信sim卡的短信,则没有报告. 顺利请帮助我添加其源代码我的密码public class MainActivity extends Activity {Button sendBtn;EditText txtphoneNo;EditText txtMessage;@Overrideprotected void onCreate(Bundle sa...

weixin_36343353的博客 728

android 双卡手机发短信/判断手机是否为双卡

MTK和高通的都应该怎么识别?这里困扰了很多的开发者,这一篇可能都是错的,希望能提供参考。android双卡双待资料 try { Class smsManagerClass = null; Class[] divideMessagePamas = { String.class }; Class[] sendMultipartText

2万+

双卡手机发送短信 - 坑爹的双卡双待

最近要写一个Android app,其中一个功能要发短信,直接照抄Android API Demos的例子OS\SMS Messaging,在自己的手机上测试,发现总是报错SmsManager.RESULT_ERROR_NO_SERVICE,理解不能。 于是开始Google。发现网上很少有人提到这个错误,而且Android上发短信,全部都是用的API Demos的发短信的例子,或者使用I

u012264122的专栏 2053

android 短信数据库 双卡,Android开发中使用mms模块收发单卡和双卡短信的教程

一.信息发送:com.android.mms.data.WorkingMessage.java 类send()函数:public void send() {......if (requiresMms() || addressContainsEmailToMms(conv, msgTxt)) {// 彩信slideshow.prepareForSend();new Thread(new Runnab...

weixin_35094077的博客 822

android双卡发短信,基于5.1.1实现

【原创】作品,转载请注明出处,请尊重作者的辛苦。 最近开发中遇到了双卡的问题,关于双卡查看了好多文章,但是没有一个能解决问题的,要么就是定制的或者有厂商提供支持的,我这里是基于android 5.1.1实现的双卡发送短信,这里需要用的反射,下面直接上代码,供大家参考: 一、首先实例化相关类 TelephonyManager mTelephonyManager = (Telep

goghlee的专栏 6089

android双卡发短信SubId和SubscriptionId转换

android9.0发短信时传入的subId实际上是SubscriptionId。 使用双卡时如果传入的是SubId(或者PhoneId、SlotId,卡1为0,卡2为1)时就需要将subId转为SubscriptionId 转换方式 SubscriptionManager sManager = (SubscriptionManager) context.getSystemService(C...

qq_33240707的博客 2508
上一篇: C语言和Java的区别和相同点
下一篇: Android USB 设备连接的官网文档
千雅爸爸
博客等级 码龄18年 292粉丝 639原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值