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. Problem in Controlling Audio

Hello,

I have some years of experience in C/C++ and bit of Java programming
in Linux, but I'm new to Android.

For start I'm trying to develop a video player on android. I'm able to
play the video using the VideoView widget. But when I'm trying to
control the volume using AudioManager, the application crashes saying:
"The application Video (process com.android.video) has stopped
unexpectedly. Please try again."

If it helps : I've downloaded the Android source (ECLAIR) and using
the sdk directly from the source and I'm using Eclipse 3.1.1. I've
successfully run the sample apps from the source code.

The following is a snapshot of what I'm trying to do in my code:

[code]
package com.android.video;
....
import android.media.AudioManager;
....
public class Video extends Activity {
   .
   .
   private AudioManager MyAudio;
   .
   .
   .
   MyVolUp.setOnClickListener(new OnClickListener(){
      public void onClick(View view) {
            MyAudio.adjustStreamVolume(MyAudio.STREAM_MUSIC,
MyAudio.ADJUST_RAISE, MyAudio.FLAG_PLAY_SOUND);
            }
      });
   .
   .

[/code]

1. What am I doing wrong here?
2. I was going through the Android source and saw that AudioManager
(even MediaPlayer) are using the native functions for handling audio.
How can I use those native function (just for experimenting, not
related to my project) in my application? We can do it using JNI but
I'm not sure how to use the native functions already there in android.

-- 

2. How to resolve the "hide" interface in Eclipse

You can exclude classes (or entire packages) from the build in Eclipse
by right-clicking on them and selecting "Build Path" -> "Exclude".



> 

3. How to resolve the "hide" interface in Eclipse

4. Urgent response needed.

5. spica gak bisa masuk home reboot terus, setelah dicoba pasangin JIT 8.1

6. - problem with onClick(

7. spica gak bisa masuk home reboot terus, setelah dicoba pasangin JIT 8.1