×

Discussion Board

Results 1 to 4 of 4

Thread: PushRegistry

  1. #1
    Registered User
    Join Date
    Feb 2013
    Location
    Madrid
    Posts
    84

    PushRegistry

    Hi all!

    I'm building a dummy app to see how it's working the pushregistry alarm, but I don't get it working.
    When I run it, I don't see anything...

    Any idea?

    here is my code (LWUIT with SDK 2.0, S40)
    Code:
    package mobileapplication2;
    
    import com.sun.lwuit.Display;
    import com.sun.lwuit.Form;
    import com.sun.lwuit.Label;
    import javax.microedition.io.ConnectionNotFoundException;
    import javax.microedition.io.PushRegistry;
    import javax.microedition.midlet.*;
    
    /**
     * @author S40
     */
    public class Midlet extends MIDlet implements Runnable {
    
        public Midlet() {
            Display.init(this);
        }
    
        public void startApp() {
            Display.getInstance().callSerially(this);
        }
    
        public void pauseApp() {
        }
    
        public void destroyApp(boolean unconditional) {
        }
    
        public void run() {
            try {
                PushRegistry.registerAlarm(getClass().getName(), 10000);
                Form f = new Form("Example");
                f.addComponent(new Label("HOLA"));
                f.show();
            } catch (ClassNotFoundException ex) {
                System.out.println("NOT FOUND");
                ex.printStackTrace();
            } catch (ConnectionNotFoundException ex) {
                System.out.println("CONNECTION");
                ex.printStackTrace();
            }
        }
    }

  2. #2
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Budapest, Hungary
    Posts
    28,568

    Re: PushRegistry

    Did you know that Java timestamps are simple numbers counting milliseconds from midnight, January 1, 1970 UTC? Now you know.
    System.currentTimeMillis()+10000 would be a better try.

  3. #3
    Registered User
    Join Date
    Feb 2013
    Location
    Madrid
    Posts
    84

    Re: PushRegistry

    Thanks for the reply @wizard_hu_ but with this change, the alarm doesn't start. I've tried in the emulator and in a 311 device.

  4. #4
    Registered User
    Join Date
    Feb 2013
    Location
    Madrid
    Posts
    84

    Re: PushRegistry

    I get it finally working

    This is my final code if you want to take a look

    Code:
                java.util.Calendar cal = Calendar.getInstance();
                cal.setTimeZone(TimeZone.getTimeZone("GMT"));
                cal.set(Calendar.MONTH, Calendar.NOVEMBER);
                cal.set(Calendar.DAY_OF_MONTH, 18);
                cal.set(Calendar.AM_PM, Calendar.PM);
                cal.set(Calendar.HOUR_OF_DAY, 15);
                cal.set(Calendar.MINUTE, 27);
                cal.set(Calendar.SECOND, 0);
                System.out.println("CALE " + cal.getTime().toString());
                Date d = new Date();
                long l = PushRegistry.registerAlarm(getClass().getName(), cal.getTime().getTime());

Similar Threads

  1. PushRegistry
    By bardu in forum Mobile Java Networking & Messaging & Security
    Replies: 6
    Last Post: 2011-10-18, 07:01
  2. PushRegistry
    By areefnadaf in forum Mobile Java General
    Replies: 1
    Last Post: 2011-05-10, 11:21
  3. PushRegistry and UID
    By loicmormont in forum Near Field Communication
    Replies: 3
    Last Post: 2010-02-22, 12:25
  4. PushRegistry
    By bardu in forum Mobile Java Networking & Messaging & Security
    Replies: 3
    Last Post: 2008-02-11, 10:05
  5. Pushregistry / NFC
    By fibbe in forum Mobile Java Networking & Messaging & Security
    Replies: 12
    Last Post: 2007-03-06, 09:04

Posting Permissions

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