2010/06/26

Inter-process Communication of BlackBerry

Maybe I just don’t know how to read the docs, or how to Google, but I was looking for this info way too much, somehow it was burried. In any case – let’s say you have to apps on the device, and they use a common PersistenStore. One app adds stuff there in the background. The other – shows a UI with a list of the items from the store. All nice and synchronized. The only problem is – there is no way to detect that the PersistentObject that you are using was updated! So if you want to have your list refreshed automatically – you have to get creative.

On the producer side, after updating the PersistentStore, post a global notification with a unique ID:
ApplicationManager.getApplicationManager().postGlobalEvent(Main.NOTIFICATIONS_ID_1);

On the consumer side (UI), register for the notifications, then catch that message and update the UI accordingly:

No comments:

Post a Comment