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. "waitForCondition(ReallocateCondition) timed out" messages w/deadlock in 2.1?

I was seeing these with Droid OpenGL reinit and now saw it again on a
regular activity/surfaceview that I was just working with.

W/SharedBufferStack(   74): waitForCondition(ReallocateCondition)
timed out (identity=13831, status=0). CPU may be pegged. trying again.

This happens on a Droid w/2.1 and now my Nexus One w/2.1.  What is
going on here?  This repeats until the process is killed.

I can't reproduce it in the SurfaceView but can reproduce it very
reliably with the Droid EGL reinit stuff.

-- 

2. How to play three images as an animation on Widget?



You cannot have an animation on an app widget, sorry.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

Android Training in US: 14-18 June 2010: http://bignerdranch.com

-- 

3. ImageView - Set width in code?

4. This code crashes the app. Could someone tell me what I'm doing wrong?

5. Melacak Robot yang Hilang

6. AbstractAccountAuthenticator getAuthToken

7. Sold Wts moto droid BNIB