Class<?> smsManagerClass = null;
Class[] divideMessagePamas = { String.class };
Class[] sendMultipartTextMessagePamas = { String.class,String.class, ArrayList.class, ArrayList.class,ArrayList.class, int.class };
Method divideMessage = null;
Method sendMultipartTextMessage = null;
smsManagerClass = Class.forName("android.telephony.SmsManager");
Method method = smsManagerClass.getMethod("getDefault", new Class[]{});
Object smsManager = method.invoke(smsManagerClass, new Object[]{});
divideMessage = smsManagerClass.getMethod("divideMessage",divideMessagePamas);
sendMultipartTextMessage = smsManagerClass.getMethod("sendMultipartTextMessage", sendMultipartTextMessagePamas);
ArrayList<String> magArray = (ArrayList<String>) divideMessage.invoke(smsManager, msg);
sendMultipartTextMessage.invoke(smsManager,phoneNumber, "", magArray, null, null, phoneType);

創作者介紹
創作者 shadow 的頭像
shadow

資訊園

shadow 發表在 痞客邦 留言(0) 人氣()