Search code examples
androidsmssmsmanager

SMS with GoogleMaps link is not sent


I work with sending SMS with the GoogleMaps link, but in some cases, the phone does not send, I can not know the reason, other links are sent normally.

Here is the image of the message: enter image description here

I would like some help in resolving this issue. And, importantly, The idea of using SMS is to not need the internet.

Here is the code I use for generation:

String uri = "http://maps.google.com/maps?q=" + lat + "," + lng;
    if (!preferences.getNumber(activity).equals("")) {
        smsBody.append(Uri.parse(uri));
        String phone1 = preferences.getNumber(activity);
        try {
            smsManager.sendTextMessage(phone1, null, msgASerEnviada, null, null);
            smsManager.sendTextMessage(phone1, null, smsBody.toString(), null, null);//mensagem com o link
            Toast.makeText(activity, "Sent to " + phone1, Toast.LENGTH_SHORT).show();
        } catch (Exception e) {
            e.printStackTrace();
            Toast.makeText(activity, "Something wrong", Toast.LENGTH_SHORT);
        }
    }

Solution

  • resolved by removing the http: //