我正在开发一款与腕带集成的应用程序,可监控心率和心率。人体温度。如果健康方面存在任何问题,则通过蓝牙连接手腕带的手机会向所有已保存的联系人群发送短信。
一切正常。但是,它不会只发送一条消息,而是向个人发送多条消息。
联系号码&联系人姓名存储在本地DB中。通过从DB收集号码,它会发送短信。
String mobile = ed2.getText().toString();
if (p1 == 1) {
Log.e("SMS HERE", "Heart Beat is LOW");
for (int i = 0; i < curContact.getCount(); i++) {
//sms.sendTextMessage(contactNo.get(i), null, " My Heart Beat is LOW." + "\n" + "Now I am in this location" + " " + Splash.strAddress, null, null);
sms.sendTextMessage(curContact.getString(curContact.getColumnIndex(DbHelper.CONTACT_PHONE)), null, " My Heart Beat is LOW." + "\n" + "Now I am in this location" + " " + Splash.strAddress, null, null);
}
} else if (p1 == 3) {
for (int i = 0; i < curContact.getCount(); i++) {
sms.sendTextMessage(curContact.getString(curContact.getColumnIndex(DbHelper.CONTACT_PHONE)), null, "My Heart Beat is HIGH." + "\n" + "Now I am in this location" + " " + Splash.strAddress, null, null);
}
} else if (p2 == 4) {
for (int i = 0; i < curContact.getCount(); i++) {
sms.sendTextMessage(curContact.getString(curContact.getColumnIndex(DbHelper.CONTACT_PHONE)), null, "My Temperature is LOW." + "\n" + "Now I am in this location" + " " + Splash.strAddress, null, null);
}
} else if (p2 == 5) {
for (int i = 0; i < curContact.getCount(); i++) {
sms.sendTextMessage(curContact.getString(curContact.getColumnIndex(DbHelper.CONTACT_PHONE)), null, "My Temperature is LOW." + "\n" + "Now I am in this location" + " " + Splash.strAddress, null, null);
}