I'm working on an application using the SMS apis for android. The receiving end is an embedded unit that only supports 7-bit encoded SMS and the string I'm sending consists only of symbols from this particular alphabet which makes you think that Android is going to send it encoded as 7 bit. But that is not the case.
Therefore I'm searching for a way to specify what encoding to use. See below for what my code looks like today. The method gsm7BitPackedToString turns a byte-array to a 7-bit string, i.e. the string only consists of 7-bit compatible characters and is copied from the internal android api.
private static boolean sendMessage(String tel,byte[] message,int septets) {
SmsManager sms = SmsManager.getDefault();
if (septets != -1) {
String a = GsmAlphabet.gsm7BitPackedToString(message,0,septets);
sms.sendTextMessage(tel, null, a, null, null);
return true;
}
return false;
}
I have considered the following solutions:
- Using some sort of internal method but none of the ones I've read about seems to exist anymore.
- Sending a data message but this requires an additional User-Data Header that the receiving end also doesn't support.
Any help is appreciated :-)