Troubleshooting guide

142
BlackBerry Java Development Environment Development Guide
Define a notification. > Implement startNotification().
public void startNotification(long consequenceID, long sourceID, long
eventID, Object configuration, Object context) {
LED.setConfiguration(500, 250, LED.BRIGHTNESS_50);
LED.setState(LED.STATE_BLINKING);
Alert.startAudio(TUNE, VOLUME);
Alert.startBuzzer(TUNE, VOLUME);
}
Stop a notification. > Implement stopNotification().
public void stopNotification(long consequenceID, long sourceID,
long eventID, Object configuration, Object context) {
LED.setState(LED.STATE_OFF);
Alert.stopAudio();
Alert.stopBuzzer();
}
Store the event notification user
profile settings.
> Implement newConfiguration().
public Object newConfiguration(long consequenceID, long sourceID,
byte profileIndex, int level, Object context) {
return CONFIG;
}
Activate data backup for the event
notification user profile settings.
> Implement SyncConverter.convert().
public SyncObject convert(DataBuffer data, int version, int UID) {
try {
int type = data.readInt();
int length = data.readCompressedInt();
if ( type == TYPE ) {
byte[] rawdata = new byte[length];
data.readFully(rawdata);
return new Configuration(rawdata);
}
} catch (EOFException e) {
System.err.println(e);
}
return null;
}
Activate data restore for the event
notification user profile settings.
> Implement SyncConverter.convert().
public boolean convert(SyncObject object, DataBuffer buffer, int version)
{
boolean retval = false;
if ( object instanceof Configuration ) {
Configuration c = (Configuration)object;
buffer.writeInt(TYPE);
buffer.writeCompressedInt(c._data.length);
buffer.write(c._data);
retval = true;
}
return retval;
}
Task Steps