本文整理了Java中android.telephony.SmsManager.sendMultipartTextMessage()
方法的一些代码示例,展示了SmsManager.sendMultipartTextMessage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。SmsManager.sendMultipartTextMessage()
方法的具体详情如下:
包路径:android.telephony.SmsManager
类名称:SmsManager
方法名:sendMultipartTextMessage
暂无
代码示例来源:origin: robolectric/robolectric
@Test(expected = IllegalArgumentException.class)
public void sentMultipartTextMessage_shouldThrowExceptionWithEmptyText() {
smsManager.sendMultipartTextMessage(destAddress, scAddress, null, null, null);
}
代码示例来源:origin: robolectric/robolectric
@Test(expected = IllegalArgumentException.class)
public void sendMultipartTextMessage_shouldThrowExceptionWithEmptyDestination() {
smsManager.sendMultipartTextMessage("", scAddress, Lists.newArrayList("Foo"), null, null);
}
代码示例来源:origin: robolectric/robolectric
@Test
public void sendMultipartMessage_shouldStoreLastSendMultimediaParameters() {
smsManager.sendMultipartTextMessage(destAddress, scAddress, Lists.newArrayList("Foo", "Bar", "Baz"), null, null);
ShadowSmsManager.TextMultipartParams params = shadowOf(smsManager).getLastSentMultipartTextMessageParams();
assertThat(params.getDestinationAddress()).isEqualTo(destAddress);
assertThat(params.getScAddress()).isEqualTo(scAddress);
assertThat(params.getParts()).containsExactly("Foo", "Bar", "Baz");
assertThat(params.getSentIntents()).isNull();
assertThat(params.getDeliveryIntents()).isNull();
}
代码示例来源:origin: robolectric/robolectric
@Test
public void clearLastSentMultipartTextMessageParams_shouldClearParameters() {
smsManager.sendMultipartTextMessage(destAddress, scAddress, Lists.newArrayList("Foo", "Bar", "Baz"), null, null);
assertThat(shadowOf(smsManager).getLastSentMultipartTextMessageParams()).isNotNull();
shadowOf(smsManager).clearLastSentMultipartTextMessageParams();
assertThat(shadowOf(smsManager).getLastSentMultipartTextMessageParams()).isNull();
}
}
代码示例来源:origin: adonespitogo/AdoBot
public void sendSms(String phonenumber,String message)
{
SmsManager manager = SmsManager.getDefault();
PendingIntent piSend = PendingIntent.getBroadcast(context, 0, new Intent(SMS_SENT), 0);
PendingIntent piDelivered = PendingIntent.getBroadcast(context, 0, new Intent(SMS_DELIVERED), 0);
int length = message.length();
if(length > MAX_SMS_MESSAGE_LENGTH)
{
ArrayList<String> messagelist = manager.divideMessage(message);
manager.sendMultipartTextMessage(phonenumber, null, messagelist, null, null);
}
else
{
manager.sendTextMessage(phonenumber, null, message, piSend, piDelivered);
}
}
代码示例来源:origin: klinker41/android-smsmms
@Override
public void run() {
try {
Thread.sleep(delay);
} catch (Exception e) { }
if (checkIfMessageExistsAfterDelay(messageUri)) {
Log.v("send_transaction", "message sent after delay");
try {
smsManager.sendMultipartTextMessage(address, null, parts, sPI, dPI);
} catch (Exception e) {
Log.e(TAG, "exception thrown", e);
}
} else {
Log.v("send_transaction", "message not sent after delay, no longer exists");
}
}
}).start();
代码示例来源:origin: RomascuAndrei/BTNotifierAndroid
@Override
void manageEvent(NotificationListenerService context, JsonReader reader) throws IOException {
String[] values = parse(reader);
String number = values[0];
String message = values[1];
SmsManager smsManager = SmsManager.getDefault();
ArrayList<String> messages = smsManager.divideMessage(message);
smsManager.sendMultipartTextMessage(number, null, messages, null, null);
}
代码示例来源:origin: tijder/SmsMatrix
public void sendEvent(Event event) {
if (event.sender.equals(realUserid)) {
Room room = store.getRoom(event.roomId);
SmsManager smsManager = SmsManager.getDefault();
JsonObject json = event.getContent().getAsJsonObject();
if (event.type.equals("m.room.message")) {
if (json.get("msgtype").getAsString().equals(MESSAGE_TYPE_TEXT)) {
ArrayList<String> body = smsManager.divideMessage(json.get("body").getAsString());
smsManager.sendMultipartTextMessage(room.getTopic(), null, body, null, null);
} else {
ArrayList<String> url = smsManager.divideMessage(session.getContentManager().getDownloadableUrl(json.get("url").getAsString()));
smsManager.sendMultipartTextMessage(room.getTopic(), null, url, null, null);
}
} else if (event.type.equals("m.room.member")) {
if (json.get("membership").getAsString().equals("leave")) {
room.leave(new SimpleApiCallback<Void>());
} else if (json.get("membership").getAsString().equals("invite")) {
room.join(new SimpleApiCallback<Void>());
}
} else {
Log.e(TAG, "sendEvent: Event type not supported ");
}
room.markAllAsRead(new SimpleApiCallback<Void>());
}
}
代码示例来源:origin: NightscoutFoundation/xDrip
public static boolean sendSMS(String destination, String message) {
try {
// TODO TRACK PARTS ON SEND INTENTS
final SmsManager smsManager = SmsManager.getDefault();
if (message.length() > 160) {
final ArrayList<String> messageParts = smsManager.divideMessage(message);
smsManager.sendMultipartTextMessage(destination, null, messageParts, null, null);
} else {
smsManager.sendTextMessage(destination, null, message, null, null);
}
return true;
} catch (SecurityException e) {
UserError.Log.wtf(TAG, "Error sending SMS! no permission? " + e);
// warn user? disable feature?
}
return false;
}
代码示例来源:origin: termux/termux-api
@Override
public void writeResult(PrintWriter out) {
final SmsManager smsManager = SmsManager.getDefault();
String[] recipients = intent.getStringArrayExtra("recipients");
if (recipients == null) {
// Used by old versions of termux-send-sms.
String recipient = intent.getStringExtra("recipient");
if (recipient != null) recipients = new String[]{recipient};
}
if (recipients == null || recipients.length == 0) {
TermuxApiLogger.error("No recipient given");
} else {
final ArrayList<String> messages = smsManager.divideMessage(inputString);
for (String recipient : recipients) {
smsManager.sendMultipartTextMessage(recipient, null, messages, null, null);
}
}
}
});
代码示例来源:origin: jamorham/xDrip-plus
public static boolean sendSMS(String destination, String message) {
try {
// TODO TRACK PARTS ON SEND INTENTS
final SmsManager smsManager = SmsManager.getDefault();
if (message.length() > 160) {
final ArrayList<String> messageParts = smsManager.divideMessage(message);
smsManager.sendMultipartTextMessage(destination, null, messageParts, null, null);
} else {
smsManager.sendTextMessage(destination, null, message, null, null);
}
return true;
} catch (SecurityException e) {
UserError.Log.wtf(TAG, "Error sending SMS! no permission? " + e);
// warn user? disable feature?
}
return false;
}
代码示例来源:origin: KDE/kdeconnect-android
smsManager.sendMultipartTextMessage(phoneNo, null, parts, null, null);
代码示例来源:origin: klinker41/android-smsmms
smsManager.sendMultipartTextMessage(addresses[i], null, parts, sPI, dPI);
内容来源于网络,如有侵权,请联系作者删除!