Another cause of your problem could be that binding to a service is
asynchonous. So if you bind to the service and directly try to send a
message it doens't work, but if you wait +/- 100ms it will work.

On 2 mei, 01:58, mickrobk <[EMAIL PROTECTED]> wrote:
> it sort of sounds like a problem with how you are setting up the 2
> emulators at once. To rule out your code try using the xmpp data
> message sender in the api demos to send a message to each emulator
> from another. Apart from that, make sure you are not signed in to
> gTalk when u make a copy of the disk to use for the second emulator.
>
> On May 1, 1:41 pm, sacoskun <[EMAIL PROTECTED]> wrote:
>
>
>
> > Hi Hielko,
>
> > Sure I can show the methods that I am using;
>
> >         private void bindXmpp()
> >         {
> >         if(bindService((new Intent()).setComponent(
>
> > com.google.android.gtalkservice.GTalkServiceConstants.GTALK_SERVICE_COMPONE­NT),
> >                 mConnection, 0))
> >         {
> >                 Log.v("BILGICIFTLIGI", "Opponent Service bound.");
> >         }
> >     }
>
> >     private ServiceConnection mConnection = new ServiceConnection() {
> >         public void onServiceConnected(ComponentName className,
> > IBinder service) {
> >                 IGTalkService xmppService =
> > IGTalkService.Stub.asInterface(service);
> >             try {
> >                 mXmppSession = xmppService.getDefaultSession();
> >                 if (mXmppSession == null) {
> >                     Log.v("BILGICIFTLIGI", "mXmppSession is NULL!!");
> >                     return;
> >                 }
> >             } catch (DeadObjectException ex) {
> >                 Log.e("BILGICIFTLIGI", "caught " + ex);
> >             }
> >         }
>
> >         public void onServiceDisconnected(ComponentName className) {
> >             mXmppSession = null;
> >         }
> >     };
>
> > And I use the following lines to communicate;
>
> >                                         IChatSession ics;
> >                                                 try
> >                                                 {
> >                                                         //TODO:XMPP returns 
> > null!!!!
> >                                                         ics = 
> > mXmppSession.getChatSession(usernameWantsToPlay);
> >                                                 
> > ics.sendDataMessage(acceptWantToPlayIntent);
> > //                                                      
> > mXmppSession.sendDataMessage(usernameWantsToPlay,
> > acceptWantToPlayIntent);
> >                                                 } catch 
> > (DeadObjectException e)
> >                                                 {
> >                 Log.e("BILGICIFTLIGI", "caught " + ex);
>
> >                                                 }
>
> > mXmppSession returns null after the bindService. This one works on the
> > first emulator that sends the first message but it does not work on
> > the second emulator that wants to respond to the first one.
> > Is there anyway that I can grab the ongoing session rather than
> > mXmppSession = xmppService.getDefaultSession()?
>
> > I have also sent the codes to your e-mail address that you have
> > specified here.
>
> > Best wishes,
> > -sacoskun
>
> > On Apr 30, 11:50 pm, Hielko <[EMAIL PROTECTED]> wrote:
>
> > > We have implemented this without problems, perhaps it would help if
> > > you show exactly what you are trying to do.
>
> > > On Apr 30, 4:37 pm, sacoskun <[EMAIL PROTECTED]> wrote:
>
> > > > Hello all,
>
> > > > In order to send and receive data message between two emulators via
> > > > XMPP I tried the following process.
>
> > > > I grab a new IGTalkSession from one activity on an emulator A by
> > > > getting the getDefaultSession() of IGTalkService.
> > > > And I create a chat session to a user who is running the same
> > > > application on emulator B and able send data message from emulator A
> > > > to emulator B.
> > > > Emulator B received the intent message via intent receiver and there
> > > > was no problem.
>
> > > > The intent receiver in emulator B starts a new activity by
> > > > NEW_TASK_LAUNCH flag and in the started activity I want to send a
> > > > respond message to emulator A via the same way. But when I want to
> > > > send back a message to Emulator A from Emulator B
> > > > by the same chat session, it cannot get the on going session of the
> > > > service. Any other session of the service I tried to get also returned
> > > > as null.
>
> > > > Any suggestion would be appreciated,
> > > > -sacoskun- Tekst uit oorspronkelijk bericht niet weergeven -
>
> - Tekst uit oorspronkelijk bericht weergeven -
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
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