0

I have a data that i read from a file and then want to send this data through sms but when i try sending shorter messages it works fine but when i send long messages it does not send.

try {


  BufferedReader br1 = new BufferedReader(new FileReader(file1));

  while ((message = br1.readLine()) != null ) {
    text1.append(message);
    text1.append('\n');
    //   msg+=message;
    //  unindexedVectors1.add(message);

  }
  msg = text1.toString();
  msg.trim();
  br1.close();
}

catch (IOException e) {
  Toast.makeText(this, (CharSequence) e, 0).show();
}

Log.d("m", msg);

for (int z = 0; z < unindexedVectors.size(); z++) {
  Toast.makeText(this, msg.trim(), 0).show();



  //sendSMS(unindexedVectors.get(z),msg);
}

}
private void sendSMS(String phoneNumber, String message) {
  SmsManager sms = SmsManager.getDefault();
  sms.sendTextMessage(phoneNumber, null, message, null, null);
}

And the message data for example is:

Stock

Id         Name       Unit       Quantity   Price      Stock     

11         Fanta      Litre      1          80         3000      

12         Pepsi      Litre      1.5        70         5         

.Stock
Id         Name       Unit       Quantity   Price      Stock     

9          Coca-cola  Litre      1.5        90         2000      

.
Bertrand Martel
  • 42,756
  • 16
  • 135
  • 159
Wijdan
  • 203
  • 3
  • 12
  • Sms messages are limited to a certain amount of characters... – OneCricketeer Jul 17 '16 at 16:11
  • But the problem is that this process breaks the sms on its own terms and the data can become meaningless. – Wijdan Jul 17 '16 at 16:15
  • If you use it correctly, the message will be split and reassembled exactly as it originally was, provided it's regular text. If it's still a concern, for some reason, use data SMS instead. Or, just ensure that none of your resulting messages are over the character limit for the alphabet you're using, and then you can split and reassemble it however you want. – Mike M. Jul 17 '16 at 16:30

0 Answers0