Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 60
Registered: ‎08-20-2009
My Device: Not Specified
Accepted Solution

Questions about Reminder and SMS feature?

I am developing on BlackBerry 4.7 Storm device.

 

Reminder:

 

My application will allow user to enter data and set Date&Time to remind the notes. Can someone please suggest me how do i handle "reminder with some small description" at that particular Date&Time?

 

SMS:

 

If i want to develop my application, which will be able to send SMS with predefined text automatically in the background to the particular number, how to do that? Is it possible, (or) my app will allow user to click "Send" kind of button which will take user to built-in SMS app and allow to send?

 

Please give me some link (or) sample source to have a look?

 

Thank you.

Developer
Posts: 3,951
Registered: ‎07-15-2008
My Device: Not Specified

Re: Questions about Reminder and SMS feature?

For Reminders, you can give a look into the PIM package.

 

For Auto SMS you can write background application which sends the SMS on when certian event occurs or like on particular time.

 

For SMS you can look into SMSDemo app. To amke Application work in background you need to extend Application class.


Use Search. "Accept Solution" If the problem is resolved.
Developer
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800
My Carrier: Globe Telecom

Re: Questions about Reminder and SMS feature?

for sending sms, you can also refer here:

 

What Is - Different ways to send SMS messages

http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800451/800563/What_is...

 

Developer
Posts: 60
Registered: ‎08-20-2009
My Device: Not Specified

Re: Questions about Reminder and SMS feature?

Thanks a lot ! I'll look into that and then update

Highlighted
Developer
Posts: 60
Registered: ‎08-20-2009
My Device: Not Specified

Re: Questions about Reminder and SMS feature?

Thanks. I need to create a reminder which should be able to handle the following features:

1. Remind Birthday whenever it occurs(i am stroring that particular user DateOfBirth in my app persistent). It can show in alert or dialog with a smal description message. Reminder alert should be able to show even my app is not launched(opened).

2. Reminder should handle recurrence. If there is a recurrence enabled for that particular DateOfBirth reminder, then reminder alarm should be able to handle recurrence feature.

 

I want to create such thing without accessing built-in Calendar/Appointment. What type of API's should i use and add in code?

 

 

Thank you very much for your helps.

 

 

Developer
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800
My Carrier: Globe Telecom

Re: Questions about Reminder and SMS feature?

First you need to create a background application. So extend the Application class. Then you mentioned already that you will use persistence. DateTimeUtilities comes in very handy in manipulating/comparing date/time. Then implement the RealTimeClockListener which is triggered every min to check if the date matches a particular date in your persistence. Or you can use TimerTask and trigger it every hour or every 24hours. To notify the user from your background application: 

 

 

synchronized(Application.getEventLock()){    UiEngine ui = Ui.getUiEngine();
    Screen screen = new Dialog(Dialog.D_OK, "Look out!!!", 
        Dialog.OK,           Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION),         Manager.VERTICAL_SCROLL);
    ui.pushGlobalScreen(screen, 1, UiEngine.GLOBAL_QUEUE);
}

 http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800505/800608/...

 

Developer
Posts: 60
Registered: ‎08-20-2009
My Device: Not Specified

Re: Questions about Reminder and SMS feature?

Thanks John for the detailed steps. We really appreciate it.

I think, i don't need to have a background application as i just need to show an reminder alert. Does background app mandatory?

I can use my main applicaiton itself for that purpose by keep running timertask in the background. which also works fine, i just tested. I created a TimerTask and it keeps running when i'm in inside of my app and even when i'm in outside of my app. I want to show a Reminder kind of alert with a small desc message when the particular timer is running in the interval. May i please know what kind of alert i can show from my Uiapplicaiton now when TimerTask is running? I tried to provide Dialog.alert, but simulator crashes if i use it.

 

 

{

try{

       timer = new Timer();    
       
       timer.scheduleAtFixedRate(new ClickTask(), 0, 50000);
   }
   catch (IllegalStateException e) {
         e.printStackTrace();
   }
  
} 
private class ClickTask extends TimerTask {
        
        public void run() {
            System.out.println("Timer Task running..");        
            //Screen screen = new Dialog(Dialog.D_OK, "Look out!!!",   //Dialog.OK,Bitmap.getPredefinedBitmap(Bitmap.EXCLAMATION),Manager.VERTICAL_SCROLL);
           //Dialog.ask("Changes made!", new String[]{"Save", "Discard", 
           //"Cancel"}, 0);
          
           Dialog.alert("My Reminder");        
        }
    }
    public boolean onClose()
    {
        UiApplication.getUiApplication().requestBackground();
        return true;
    }

 

 

 

Suggstions please !

 

Thanks.

 

Developer
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800
My Carrier: Globe Telecom

Re: Questions about Reminder and SMS feature?

You don't really need to have a background application to satisfy your requirements. For me, It's better to put it in a background app. or If you still need a UI aside from the once that sends the notification, Create an application with alternate entry point.

 

For the dialog screen, You are trying to invoke the dialog alert from the TimerTask which is a separate thread. So to push a dialog screen from another thread, use the code i posted earlier. synchronize it with the eventLock.

Developer
Posts: 60
Registered: ‎08-20-2009
My Device: Not Specified

Re: Questions about Reminder and SMS feature?

I modifed the TimerTask code as below.With this code, now i'm able to achieve the Reminder alert that i'm showing when timer is running.

 

 

private class ClickTask extends TimerTask {

public void run()
        {
            UiApplication.getUiApplication().invokeLater(new Runnable() 
            {
                public void run() 
                {
                     Dialog.alert("Reminder Alert Show");
                }
                });
            
        }
    }

}

 

 

But it shows the alert dialog only when i'm in inside of my applcation. But when i exit my application, i'm not getting this alert dialog on top of other apps screen. What are other restrictions on this i have to follow up when i am having Timer running always in the background and don't use any of hidden background app?

 

Appreciate if you could help me !

 

Thank you.

 

 

Developer
Posts: 905
Registered: ‎02-07-2009
My Device: BlackBerry Torch 9800
My Carrier: Globe Telecom

Re: Questions about Reminder and SMS feature?

That's a normal behavior. since your using timertask and it uses a Timer object to run, once the application exits, the Timer object is also destroyed. So what you can do is, instead of exiting the application, why not put your app on the background, or better yet create a background application. Smiley Happy