BlackBerry Forums Support Community               

Closed Thread
 
LinkBack Thread Tools
Old 07-16-2008, 10:50 PM   #1 (permalink)
New Member
 
Join Date: Jul 2008
Model: 8820
PIN: N/A
Carrier: AT&T
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default Sending SMS/Message to self

Please Login to Remove!

I need to notify the user of some event by placing a message in his inbox. I can do it by using folder.appendMessage() but that does not trigger the actions that the profile does when a message is received.

I read here [Posting restrictions would let me post link ] that applications can communicate through SMS, but the example shows how to set up an SMS listener. The developer guide shows how to send SMS to other numbers.
Is there any way I can send a SMS to self, basically get the buzzer/LED triggered as normal SMS without incurring cost on the end user?
In other words, what is the loopback address of SMS?

Regards
Rohit
Offline  
Old 07-17-2008, 07:58 AM   #2 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

Use net.rim.device.api.notification.NotificationsManag er

Call registerNotificationObjects() once on device start up, call triggerNotification() when you want to alert the user. The type of alert can be selected by the user through the profile selection and editing interface. The application will have to be compiled to Auto-run on startup.

Code:
...

   private static final long MY_NOTIFICATION = 0x71a090a90bdcee80L; // A unique value
   private static final String MY_NOTIFICATION_NAME = "My Notification";
   private static long eventId = 0;
...

  // Register notification object

    private void registerNotificationObjects()
    {
        //New Notifications Sources - these will show up as editable configurations in the Profiles application
        NotificationsManager.registerSource( MY_NOTIFICATION,
            new Object()
            {
                public String toString()
                {
                    return MY_NOTIFICATION_NAME;
                }
            }
            , NotificationsConstants.IMPORTANT
        );
    }

    private void triggerNotification()
    {
        int trigger = NotificationsConstants.MANUAL_TRIGGER;
        long timeout = -1; //the timeout parameter is IGNORED unless the TRIGGER is OUT_OF_HOLSTER_TRIGGER 
        NotificationsManager.triggerImmediateEvent( MY_NOTIFICATION, eventId++, this, null);
    }
Offline  
Old 07-17-2008, 09:06 AM   #3 (permalink)
New Member
 
Join Date: Jul 2008
Model: 8820
PIN: N/A
Carrier: AT&T
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks! I'll try that tonite!
Offline  
Old 07-17-2008, 06:44 PM   #4 (permalink)
New Member
 
Join Date: Jul 2008
Model: 8820
PIN: N/A
Carrier: AT&T
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

This didn't quite help. I am trying to send a message to self. I don't want to create a new notification.
I did get the ID of the "Messages" source and tried triggerImmediateEvent but I couldn't figure out how to insert the message.
Offline  
Old 07-18-2008, 09:44 PM   #5 (permalink)
BlackBerry Extraordinaire
 
Join Date: Jan 2006
Model: LEZ10
OS: 10.0.10
Carrier: Rogers CA
Posts: 1,704
Post Thanks: 20
Thanked 77 Times in 68 Posts
Default

You would use folder.appendMessage() as you claimed you could in your first post. The code I provided will cause the notification you need. No cost to the user and it will work even if the user is out of coverage. The notification would only be the same as an incoming SMS if the user set it up that way, but isn't giving the user that choice better?
Offline  
Old 07-19-2008, 04:31 AM   #6 (permalink)
New Member
 
Join Date: Jul 2008
Model: 8820
PIN: N/A
Carrier: AT&T
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I don't know why but I thought it would be a good idea not to have the user manage extra configurations when its a simple message. Anyways, I asked at the Blackberry support forums and they said its not technically possible.
Offline  
Old 07-19-2008, 04:32 AM   #7 (permalink)
New Member
 
Join Date: Jul 2008
Model: 8820
PIN: N/A
Carrier: AT&T
Posts: 5
Post Thanks: 0
Thanked 0 Times in 0 Posts
Default

I mean, technically possible to send a SMS to yourself via API.
Offline  
Closed Thread


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Copyright 2004-2014 BlackBerryForums.com.
The names RIM and BlackBerry are registered Trademarks of BlackBerry Inc.