×

Discussion Board

Results 1 to 13 of 13
  1. #1
    Regular Contributor
    Join Date
    May 2013
    Posts
    271

    How to put user selected alert in push registry alarm

    I am working on s40 and i know how to use push registry alarm .
    I want to integrate it with my time picker(which i made with help of spinners) where i gave hours value and minutes value which user will select according to his choice. I made 12 hour format.

    I need to pass difference time (between current value of system and user selected value from time picker i.e can be a.m and p.m too) in PushRegistry.registerAlarm(MIDLET_CLASS_NAME, diffrencetime);

    How to do this

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,073

    Re: How to put user selected alert in push registry alarm

    Quote Originally Posted by Manpreet_Singh View Post
    I am working on s40 and i know how to use push registry alarm .
    I want to integrate it with my time picker(which i made with help of spinners) where i gave hours value and minutes value which user will select according to his choice. I made 12 hour format.

    I need to pass difference time (between current value of system and user selected value from time picker i.e can be a.m and p.m too) in PushRegistry.registerAlarm(MIDLET_CLASS_NAME, diffrencetime);

    How to do this
    diffencetime is time in mile-seconds that you need to pass in this PushRegistry.registerAlarm(MIDLET_CLASS_NAME, diffrencetime);

    To Calculate it you need to first find the actual difference in Current time and time selected on the time picker in hours+mins+seconds then convert it all to seconds and miliseconds.

    If your current time is in AM and the time selected on Alarm is also in AM but is lower then the current time then it means that the person trying to set the alarm for tomorrow add 12hours.... else use the actual difference.... the same is true in case of current time in PM and selected time in PM and lower then current time.

    In case of current time in AM and selected time in PM... add 12 hours - same in case of current time in PM and selected time in AM.

    If both are in AM or PM and selected time is > the current time them difference is simple difference of time.
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  3. #3
    Regular Contributor
    Join Date
    May 2013
    Posts
    271

    Re: How to put user selected alert in push registry alarm

    thanks sir..done

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,073

    Re: How to put user selected alert in push registry alarm

    Your welcome.
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  5. #5
    Regular Contributor
    Join Date
    May 2013
    Posts
    271

    Re: How to put user selected alert in push registry alarm

    hello sir,

    I was using 12 hours format and getting hours by following method
    int hourc=c.get(Calendar.HOUR);
    When i was running on emulator and device(while debugging at 12:30 after noon) system time through this function was coming as 00:30 . I was expecting as 12:30

  6. #6
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,073

    Re: How to put user selected alert in push registry alarm

    Was it 12:30AM.... because 12:30AM will return 00:30 - check the system clock - test on real device.
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  7. #7
    Regular Contributor
    Join Date
    May 2013
    Posts
    271

    Re: How to put user selected alert in push registry alarm

    sir it was 12:30 day time ( 3 hours before i tried) . I tested on asha 310 ,there too it is giving me 0. This should come at midnight.
    Here is my code
    Code:
       Calendar c = Calendar.getInstance();
    				     		
    				     c.setTime(d1);
    				     int hourc=c.get(Calendar.HOUR);
    				     System.out.println("Vlue of hour--------------------"+c.get(Calendar.HOUR));
    				     System.out.println("HOUR FROM SYSTEM "+hourc);
    				     int minc=c.get(Calendar.MINUTE);
    				     System.out.println("MINUTES FROM SYSTEM "+minc);
    				     int eventc=c.get(Calendar.AM_PM);
    				     System.out.println("EVENTC IS"+eventc);
    Output while debugging :
    Vlue of hour--------------------0
    HOUR FROM SYSTEM 0
    MINUTES FROM SYSTEM 16
    EVENTC IS1
    Last edited by Manpreet_Singh; 2013-08-30 at 11:12.

  8. #8
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,073

    Re: How to put user selected alert in push registry alarm

    Whats the value of d1 in - c.setTime(d1);

    Put System.out.println(d1); also
    And cut paste the complete output here - all SOP's.... what are you getting for eventc?
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  9. #9
    Regular Contributor
    Join Date
    May 2013
    Posts
    271

    Re: How to put user selected alert in push registry alarm

    this was the output ,getting 1 for EVENTC

    Value of d1 is Fri Aug 30 12:08:04 GMT+05:30 2013
    Vlue of hour--------------------0
    HOUR FROM SYSTEM 0
    MINUTES FROM SYSTEM 8
    EVENTC IS 1

  10. #10
    Regular Contributor
    Join Date
    May 2013
    Posts
    271

    Re: How to put user selected alert in push registry alarm

    ok sir. will try this condition , thanks

  11. #11
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,073

    Re: How to put user selected alert in push registry alarm

    Quote Originally Posted by Manpreet_Singh View Post
    this was the output ,getting 1 for EVENTC

    Value of d1 is Fri Aug 30 12:08:04 GMT+05:30 2013
    Vlue of hour--------------------0
    HOUR FROM SYSTEM 0
    MINUTES FROM SYSTEM 8
    EVENTC IS 1
    Eventc is 1 -- shows its PM
    J2me HOUR field gives output in 12 hour format - where it can values only from 0 - 11.
    Hence in your program - please check if Eventc is 1 and Hour value is 0 you can replace it with 12 - for your time diff. calculation.
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

  12. #12
    Regular Contributor
    Join Date
    May 2013
    Posts
    271

    Re: How to put user selected alert in push registry alarm

    Thanks sir . That condition i have applied. Is there a way that we can change the outlook of alert we receive when we apply alarm. I am getting following three elemnts on alert
    1.Reminder
    2. Time of alarm
    3.Name of midlet

    I want to show some message on this alert fr eg. "New Thought" ,i don't want to show this word Reminder and i also want to display icon of my app on this alert. Is that possible?
    Last edited by Manpreet_Singh; 2013-08-31 at 06:20.

  13. #13
    Nokia Developer Champion
    Join Date
    Feb 2009
    Location
    Noida, India
    Posts
    3,073

    Re: How to put user selected alert in push registry alarm

    You cannot modify this system generated alert for PushRegistry Alarm, but as soon as user accepts it and your app is launched - you can display your desired message.
    thanks,
    ~Amitabh
    (Champion of the Month -Aug'13)
    Follow me on my blog for Innovative Mobile Apps

Similar Threads

  1. Push Registry Alarm
    By albert.bayita in forum Mobile Java General
    Replies: 1
    Last Post: 2011-04-09, 12:28
  2. Push Registry Alarm
    By albert.bayita in forum Mobile Java General
    Replies: 0
    Last Post: 2011-04-09, 07:54
  3. Push registry alarm notification.
    By chetubc in forum Mobile Java Networking & Messaging & Security
    Replies: 6
    Last Post: 2009-05-13, 06:17
  4. Alarm based push registry
    By devdattac in forum Mobile Java General
    Replies: 10
    Last Post: 2009-04-30, 11:45
  5. Push Registry alarm issue...
    By kumara1423 in forum Mobile Java General
    Replies: 2
    Last Post: 2007-05-23, 05:06

Posting Permissions

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