I'm making an app that at some point will send the network information about the current device to a new number. I am able to send the message fine but when the message is received the formatting/content of the text is strange.
I'm running my app on a 2.2 emulator.
My code for sending the message is:
SmsManager smsManager = SmsManager.getDefault(); //SMS Manager
ConnectivityManager connManager; //Connectivity Manager
NetworkInfo network = connManager.getNetworkInfo(networkType); //Getting the network type
String sendTo = "5556"; //Number to send to
String myMsg = ("Network: " + network.toString()); //Message will contain
smsManager.sendTextMessage(sendTo, null, myMsg, null, null); //Sending the message
The received message is shown below:
Any ideas?
NetworkInfo.toString()
reference:
Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:
getClass().getName() + '@' + Integer.toHexString(hashCode())
See Writing a useful
toString
method if you intend implementing your owntoString
method.
Means that the default implementation of toString()
does not give any real information that you can use.