sms sent from java app does not appear on android device

panipsilos

I have an application where I m using an sms provider to send sms to my android device. I am sending a message of the following form:

  message =  "value: "+Float.toString(float1)+" and ratio: "+Float.toString(float2)

I m using the jva.net library and the code is :

System.out.println("Sending sms");

InputStream response = null;
URLConnection connection = null;
try {
    connection = new URL("https://somesmsprovider.com/sms/sms.jsp?user=user&password=pass&mobiles=xxxxxxxxxx&sms="+message).openConnection();
} catch (MalformedURLException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
} catch (IOException e1) {
    // TODO Auto-generated catch block
    e1.printStackTrace();
}

However, what i receive on my device is just: "value:"

I guess it has to do with the encoding. The provider has an option to activate unicode encoding but that didnt help either. Anybody has an idea why I m not able to display the sms properly?

Thnks

Mike M.

Apparently the spaces in the resulting URL were causing the problem. Simply replacing them with their percent-encoded value - %20 - seems to do the trick.

message = message.replace(" ", "%20");

If you include any characters in your message other than the alphanumerics and basic punctuation, you may need to URL-encode the whole String. The URLEncoder class is available in Android, though it encodes spaces as +, so you might have to perform a replace() similar to the above after the encoding, as I would imagine + would go through unchanged in the message body.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Installing Android app on device from Android Studio

From Dev

Uninstall Android Wear App From Real Device

From Dev

Does the JSONStore data/documents from Worklight persist on device (iPhone/Android) even after deleting the App?

From Dev

Why emails sent by smtpclient does not appear in sent items

From Dev

Android - Sent SMS message does not show in native Messages app

From Dev

Android delete sms messages in sent box

From Dev

Application icon does not appear after installing android app

From Dev

Android - Don't receive sms sent by sms manager

From Dev

Android - delete phone verification SMS sent to self

From Dev

Running app from android studio does not save onto my android device anymore

From Dev

Cordova: launch SMS app and confirm that an SMS was sent

From Dev

Why does a blurry image appear in a simple android camera app?

From Dev

Android - SMS sent intent not received 100% of time

From Dev

sample android app does not deploy in android device

From Dev

App does not appear in Android emulator

From Dev

Custom events does not appear even if the are sent

From Dev

Notification not sent to android wear device

From Dev

Sending SMS Message from Android App

From Dev

Block sent SMS from being logged in default messaging app

From Dev

Android - delete phone verification SMS sent to self

From Dev

How to track sent messages (SMS) in android?

From Dev

Android all variables are reset when SMS is sent

From Dev

Android App does not appear on Emulator

From Dev

Saving sms was sent from my app into db of sms app native

From Dev

Android - SMS sent intent not received 100% of time

From Dev

Link to SMS app does not open in Android mail

From Dev

When I edit Android layout it does not appear on device after running

From Dev

How to send a separate default text every time text is sent via SMS service from android app?

From Dev

How to make my App appear on my Android Device?

Related Related

  1. 1

    Installing Android app on device from Android Studio

  2. 2

    Uninstall Android Wear App From Real Device

  3. 3

    Does the JSONStore data/documents from Worklight persist on device (iPhone/Android) even after deleting the App?

  4. 4

    Why emails sent by smtpclient does not appear in sent items

  5. 5

    Android - Sent SMS message does not show in native Messages app

  6. 6

    Android delete sms messages in sent box

  7. 7

    Application icon does not appear after installing android app

  8. 8

    Android - Don't receive sms sent by sms manager

  9. 9

    Android - delete phone verification SMS sent to self

  10. 10

    Running app from android studio does not save onto my android device anymore

  11. 11

    Cordova: launch SMS app and confirm that an SMS was sent

  12. 12

    Why does a blurry image appear in a simple android camera app?

  13. 13

    Android - SMS sent intent not received 100% of time

  14. 14

    sample android app does not deploy in android device

  15. 15

    App does not appear in Android emulator

  16. 16

    Custom events does not appear even if the are sent

  17. 17

    Notification not sent to android wear device

  18. 18

    Sending SMS Message from Android App

  19. 19

    Block sent SMS from being logged in default messaging app

  20. 20

    Android - delete phone verification SMS sent to self

  21. 21

    How to track sent messages (SMS) in android?

  22. 22

    Android all variables are reset when SMS is sent

  23. 23

    Android App does not appear on Emulator

  24. 24

    Saving sms was sent from my app into db of sms app native

  25. 25

    Android - SMS sent intent not received 100% of time

  26. 26

    Link to SMS app does not open in Android mail

  27. 27

    When I edit Android layout it does not appear on device after running

  28. 28

    How to send a separate default text every time text is sent via SMS service from android app?

  29. 29

    How to make my App appear on my Android Device?

HotTag

Archive