Problem while sending SMS- Could not connect to cilent socket : connection refused.

by javame_android » Wed, 31 Dec 2008 14:07:03 GMT


Sponsored Links
 Hi,

I am trying to write a simple application for sending SMS. In that one
needs to enter a number and after fetching that number from the
textbox sms should be send to that number. I have tried to implement
that code on emulator. It gives could not connect to client socket:
Connection refused. What is it? Am I missing something?

Hope to get a reply soon.

Thanks & Regards
Sunil
--~--~---------~--~----~------------~-------~--~----~



Problem while sending SMS- Could not connect to cilent socket : connection refused.

by javame_android » Wed, 31 Dec 2008 14:44:00 GMT


 Hi,

Thanks for replying.

You are saying to add permission for internet but I am not using
anything related to internet. I have written a simple application that
just sends message. That is working fine but this problem has come
when trying to implement with GUI. I have added the permission for
sending sms. I want to send SMS on the click event of button. When I
click the button then it gives the error as could not connect to
client socket : connection refused.

Any help would be appreciated.

Thanks & Regards
Sunil




--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Problem while sending SMS- Could not connect to cilent socket : connection refused.

by javame_android » Wed, 31 Dec 2008 14:56:55 GMT


 package com.android.hello;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.telephony.gsm.SmsManager;
import android.text.Editable;

public class HelloAndroid extends Activity
{
    final String textMsg = "Hello, Message sent on Click";

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.login);
        final SmsManager smsManager = SmsManager.getDefault();
        Button button = (Button)findViewById(R.id.ok);
        button.setOnClickListener(new Button.OnClickListener()
        {
                public void onClick(View arg0)
                {
                        EditText editText = (EditText)findViewById(R.id.entry);
                Editable tPhone = editText.getText();
                String numToSendMsg = tPhone.toString();
                smsManager.sendTextMessage(numToSendMsg, null,
textMsg, null, null);
                }
        });
    }
}

Above is the code that I am trying to run. Everything is working fine,
GUI is displayed properly. The problem only comes when I click on
button. I am very new to Android so not getting where I am getting
wrong.

Thanks
Sunil


--~--~---------~--~----~------------~-------~--~----~



Problem while sending SMS- Could not connect to cilent socket : connection refused.

by javame_android » Wed, 31 Dec 2008 16:52:56 GMT


 Hi,

Did what you said but no success. Still the same problem GUI displayed
properly but after entering number in the textbox and pressing the
button it gives on ddms console as could not connect to client
socket : connection refused.

By the way I did what you said but I dont think for sending sms one
has to write uses-permission for receiving sms.
Anyways thanks.

Is there anybody who has encountered same error and can help me out.

Thanks & Regards
Sunil




--~--~---------~--~----~------------~-------~--~----~



Problem while sending SMS- Could not connect to cilent socket : connection refused.

by javame_android » Thu, 01 Jan 2009 13:33:46 GMT


 Hi,

This was solved by calling another activity. It means UI displayed in
one activity and sms sending task achieved in another activity. I dont
know whether this is the way or not but it removed this error.

Sunil





--~--~---------~--~----~------------~-------~--~----~



Other Threads

1. Bluetooth signal strength

I haven't been able to find this in the SDK.  Is it possible for me to
be able to read the signal strength of the Bluetooth when they are
connected to A2DP headsets?

Thanks,
JB

-- 

2. Zooming on a custom overlay

Hi all,

does anybody knows if it is possible to zoom in and out on a custom
overlay and enlarge the image?
I'd like to do something like that:
http://geoserver.nima.puc-rio.br/puc-rio/

If you zoom in, you'll notice that the image gets bigger.

-- 

3. Question on Webview, I can't post on.

4. Andriod apps connect to HID USB Device

5. Question about zooming a View in android

6. Detect when Google Maps has finished downloading new tiles

7. music app