Hi,
I am having a weird problem with an Intentreceiver.
I got "Unable to start receiver" error.

Can somebody help me, the deadline is really really near and this is
the last thing to finish my project :))
Thanks !!!

This is my code:
**********************************************************************
public class HangXmpp extends Activity {
    IXmppSession mXmppSession = null;
    EditText mUsernameField;
    Button mSendButton;
    String mUsernameLocal;
    @Override
    protected void onCreate(Bundle icicle) {
        ........
        bindXmppService();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        unbindService(mConnection);
    }

    private void bindXmppService() {
        bindService((new Intent()).setComponent(
 
com.google.android.xmppService.XmppConstants.XMPP_SERVICE_COMPONENT),null,
mConnection, 0);
    }

    private Intent getIntentToSend() {
        Intent intent = new Intent(HangXmppReceiverB.ACTION_UPDATE);
        intent.putExtra("help", "YES");
        return intent;
    }

    private ServiceConnection mConnection = new ServiceConnection() {
        public void onServiceConnected(ComponentName className,
IBinder service) {
            IXmppService xmppService =
IXmppService.Stub.asInterface(service);
            try {
                mXmppSession = xmppService.getDefaultSession();
                mUsernameLocal = mXmppSession.getUsername();
            } catch (DeadObjectException ex) {
 
showMessage(getText(R.string.found_stale_xmpp_service));
            }
            mSendButton.setEnabled(true);
        }

        public void onServiceDisconnected(ComponentName className) {
            // This is called when the connection with the service has
been
            // unexpectedly disconnected -- that is, its process
crashed.
            mXmppSession = null;
            mSendButton.setEnabled(false);
        }
    };

    private View.OnClickListener mOnClickListener = new
View.OnClickListener() {

           try {
                mXmppSession.sendDataMessage(username,
getIntentToSend());
           } catch (DeadObjectException ex) {
 
showMessage(getText(R.string.found_stale_xmpp_service));
                mXmppSession = null;
                bindXmppService();
           }
          }
          finish();
        }
    };
}


public class HangXmppReceiverB extends IntentReceiver {
    static final String ACTION_UPDATE =
"code.google.hangDroid.HangXmppReceiver.ACTION_UPDATE_DATA";

    public void onReceiveIntent(Context context, Intent intent) {
        Intent Myintent = new Intent();
        NotificationManager nm;
        Bundle bundle = intent.getExtras();

//********
// This log you can see
//********
        Log.v("HangDroid",intent.toString());
        if (intent.getAction().equals(ACTION_UPDATE)) {
           nm =
(NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE);
           nm.notifyWithText(123, "Sorry, but the Challenger dont want
to play with you",
                        NotificationManager.LENGTH_LONG, null);
        }
    }
}
**********************************************************************

Manifiest File
....
<receiver class=".HangXmppReceiverB">
   <intent-filter>
       <action
android:value="code.google.hangDroid.HangXmppReceiver.ACTION_UPDATE_DATA"/
>
   </intent-filter>
</receiver>
......

LOGCAT
.............
I/ActivityManager(  551): Displayed activity {code.google.hangDroid/
code.google.hangDroid.HangPlay}: 2122 ms
I/ActivityManager(  551): Done launching {code.google.hangDroid/
code.google.hangDroid.HangPlay}: 2139 ms
D/ActivityManager(  551): Stopping: HistoryRecord{4018f718
{code.google.hangDroid/code.google.hangDroid.HangDroig}}
I/ActivityManager(  551): Starting activity: Intent
{ comp={code.google.hangDroid/code.google.hangDroid.HangXmpp} }
D/ActivityThread( 1143): Performing launch of ActivityRecord{40160eb8
{code.google.hangDroid/code.google.hangDroid.HangXmpp}}
D/xmppSrv (  612): [XmppService] getDefaultSession: return
[EMAIL PROTECTED]
I/ActivityManager(  551): Displayed activity {code.google.hangDroid/
code.google.hangDroid.HangXmpp}: 247 ms
I/ActivityManager(  551): Done launching {code.google.hangDroid/
code.google.hangDroid.HangXmpp}: 303 ms
D/ActivityManager(  551): Stopping: HistoryRecord{4012f238
{code.google.hangDroid/code.google.hangDroid.HangPlay}}
D/ActivityManager(  551): Resuming: HistoryRecord{4012f238
{code.google.hangDroid/code.google.hangDroid.HangPlay}}
D/xmppSrv (  612): [DataMsgProvider] parseExtension: got (help,YES)
V/HangDroid( 1143): Intent
{ action=code.google.hangDroid.HangXmppReceiver.ACTION_UPDATE_DATA
comp={code.google.hangDroid/code.google.hangDroid.HangXmppReceiverB}
[EMAIL PROTECTED] }
D/dalvikvm( 1143): Exception java/lang/RuntimeException from
Looper.java:76 not caught locally
D/dalvikvm( 1143): Exception java/lang/RuntimeException from
ZygoteInit.java:1176 not caught locally
D/AndroidRuntime( 1143): Shutting down VM
W/dalvikvm( 1143): threadid=3: thread exiting with uncaught exception
(group=0x4000e648)
E/AndroidRuntime( 1143): Uncaught handler: thread Main exiting due to
uncaught exception
E/AndroidRuntime( 1143): java.lang.RuntimeException: Unable to start
receiver code.google.hangDroid.HangXmppReceiverB:
java.lang.NullPointerException
E/AndroidRuntime( 1143):        at
android.app.ActivityThread.handleReceiver(ActivityThread.java:1498)
E/AndroidRuntime( 1143):        at android.app.ActivityThread.access
$2100(ActivityThread.java:76)
E/AndroidRuntime( 1143):        at android.app.ActivityThread
$H.handleMessage(ActivityThread.java:1023)
E/AndroidRuntime( 1143):        at
android.os.Handler.dispatchMessage(Handler.java:80)
E/AndroidRuntime( 1143):        at android.os.Looper.loop(Looper.java:
71)
E/AndroidRuntime( 1143):        at
android.app.ActivityThread.main(ActivityThread.java:2506)
E/AndroidRuntime( 1143):        at
java.lang.reflect.Method.invokeNative(NativeMethod)
E/AndroidRuntime( 1143):        at
java.lang.reflect.Method.invoke(Method.java:380)
E/AndroidRuntime( 1143):        at android.os.ZygoteInit
$MethodAndArgsCaller.run (ZygoteInit.java:1170)
E/AndroidRuntime( 1143):        at
android.os.ZygoteInit.main(ZygoteInit.java:1121)
E/AndroidRuntime( 1143):        at
android.dalvik.NativeStart.main(Native Method)
E/AndroidRuntime( 1143): Caused by: java.lang.NullPointerException
E/AndroidRuntime( 1143):        at
code.google.hangDroid.HangXmppReceiverB.onReceiveIntent(HangXmppReceiverB.java:
33)
E/AndroidRuntime( 1143):        at
android.app.ActivityThread.handleReceiver(ActivityThread.java:1490)
E/AndroidRuntime( 1143):        ... 10 more
I/Process (  551): Sending signal. PID: 1143 SIG: 3
I/dalvikvm( 1143): threadid=7: reacting to signal 3
I/dalvikvm( 1143): DALVIK THREADS:
I/dalvikvm( 1143): "Main" prio=5 tid=3 NATIVE
I/dalvikvm( 1143):   | group="main" sCount=1 dsCount=0 s=0
obj=0x4000eca0

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
Announcing the new M5 SDK!
http://android-developers.blogspot.com/2008/02/android-sdk-m5-rc14-now-available.html
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to