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
Contributor
djpinto
Posts: 41
Registered: ‎11-15-2012
My Device: Curve 9320
My Carrier: Optimus
Accepted Solution

Notification don't run in device

Hello, I' create a simple application for test notification, but application don't running on my device and show error "Error starting PushNotification; Module 'PushNotification' attempts to access a secure API.".

 

My code is:

 

public class PushNotification extends UiApplication{

public static void main(String[] args){

PushNotification pn = new PushNotification();
pn.enterEventDispatcher();
}

PushNotification(){
pushScreen(new ScreenStart());
}
}

 


class ScreenStart extends MainScreen{



ScreenStart(){
setTitle("Application Notification");

ButtonField bf = new ButtonField("Receive Notification");
bf.setChangeListener(new FieldChangeListener() {

public void fieldChanged(Field field, int context) {
try{
ApplicationIndicatorRegistry reg = ApplicationIndicatorRegistry.getInstance();
EncodedImage image = EncodedImage.getEncodedImageResource("icon.png");
ApplicationIcon icon = new ApplicationIcon(image);
ApplicationIndicator indicator = reg.register(icon, false, true);
indicator.setValue(7);
}
catch(Exception e){

}

}
});
add(bf);




ButtonField bfc = new ButtonField("Clean Notification");
bfc.setChangeListener(new FieldChangeListener() {

public void fieldChanged(Field field, int context) {
try{
ApplicationIndicatorRegistry reg = ApplicationIndicatorRegistry.getInstance();
reg.unregister();
}
catch(Exception e){
}
}
});
add(bfc);

}
}

 

cumps

Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: Notification don't run in device

Did you sign the application before putting it on the device?

 

Please use plain text.
Contributor
djpinto
Posts: 41
Registered: ‎11-15-2012
My Device: Curve 9320
My Carrier: Optimus

Re: Notification don't run in device

Yes but I don't restart eclipse for apply.

 

Now it works thank you :smileywink:

Please use plain text.