// 读取短信内容
//不同机型可能获取不全
//查看权限是否已允许
var main = plus.android.runtimemainactivity();
var uri = plus.android.importclass("android.net.uri");
var contactscontract = plus.android.importclass('android.provider.contactscontract');
var uri = uri.parse("content://sms/");
var cr = main.getcontentresolver();
plus.android.importclass(cr);
var cur = cr.query(uri, null, null, null, null);
plus.android.importclass(cur);
cur.movetofirst();
while (cur.movetonext())
{
var index_address = cur.getcolumnindex("address");
var address = cur.getstring(index_address);
//短信内容
var index_body = cur.getcolumnindex("body");
var body = cur.getstring(index_body);
console.log('撒旦撒',body)
//类型1接收 2发送
var index_type = cur.getcolumnindex("type");
var type = cur.getstring(index_type);
console.log(address,body,type);
}
cur.close();
工作需求,记录一下