×

Discussion Board

Results 1 to 3 of 3
  1. #1
    Registered User
    Join Date
    Apr 2007
    Posts
    4

    snapEventListner??

    Why do I need this? The servfer should just send me data.

  2. #2
    Registered User
    Join Date
    Sep 2006
    Posts
    4

    Smile Re: snapEventListner??

    SnapEventListener is an interface and the full qualified name is com.nokia.sm.net.SnapEventListener.
    If you create your own class that implements this interface, you can receive notifications from the server. The notifications come in 2 different flavors, events and errors.
    Here is an example of a class that implements SnapEventListener:

    package com.acme.snap;

    import java.util.Vector;
    import com.nokia.sm.net.SnapEventListener;

    public class DebugListener implements SnapEventListener {
    public void processEvents(Vector list) {
    // TODO Add code to handle events.
    }

    public void processServerError(int code, String message, int severity) {
    // TODO Add code to handle server error.
    }

    }

    From your game code, instantiate your class and add it as listener to the ServerComm instance you have:

    ServerComm comm;
    DebugListener listener;
    ...
    listener = new DebugListener();
    comm.addSnapEventListener(listener);
    ...

    I hope this helps you.

  3. #3
    Regular Contributor
    Join Date
    Mar 2006
    Posts
    59

    Re: snapEventListner??

    Check out the SNAP Mobile Game Developers Guide chapter 3.17 "Polling for asyncronous events". This will also help you understanding the idea of the snapEventListener aka polling.

    http://www.forum.nokia.com/info/sw.n..._3_en.pdf.html

    - Heidi

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×