我正在尝试向移动设备发送短信。如何在正文中发送大数据?订单ID应该在线,产品名称在线,在线价格,在线状态。如何安排身体?
var data2 = db.collection("UserProfile").doc(mauths)
.get().then(doc =>
{
mobile= doc.data().MobileNumber;
console.log("mobile",mobile);
// Your Account Sid and Auth Token from twilio.com/console
const accountSid = '======';
const authToken = '=======';
const client = require('twilio')(accountSid, authToken);
client.messages
.create({
body: "Your " + pn + " has been cancelled " ,// need to more content line by line
from: '+-=======',
to: mobile
})
.then(message => {
});
})
我认为这对你很有用。
public static final String SMS_BUNDLE = "pdus";
public void onReceive(Context context, Intent intent) {
Bundle intentExtras = intent.getExtras();
if (intentExtras != null) {
Object[] sms = (Object[]) intentExtras.get(SMS_BUNDLE);
String smsMessageStr = "";
for (int i = 0; i < sms.length; ++i) {
String format = intentExtras.getString("format");
SmsMessage smsMessage = SmsMessage.createFromPdu((byte[]) sms[i], format);
String smsBody = smsMessage.getMessageBody().toString();
String address = smsMessage.getOriginatingAddress();
smsMessageStr += "SMS From: " + address + "n";
smsMessageStr += smsBody + "n";
}
MainActivity inst = MainActivity.instance();
inst.updateInbox(smsMessageStr);
}
}