07-21-2013 02:52 PM
I'll be open about this so here goes:
I'm building a sligthly different but with more features, an app that intercepts anything incoming into Hub.
1.) Is there such a listener of events provided by API somewhere?
2.) Is there a Hub database perhaps that I can monitor and react with my own app when it updates?
3.) If there are several listeners needed for this project, please, point me at those classes, I can manage from there?
Like SmsTransport, CallListener...?
4.) Is there a way to dynamically fetch all active accounts currently in Hub?
I tried with AccountService, all I get is a list of empty displayNames besides GMail and Live. Where are socials like Facebook, Twitter? 3rd party like GTalk, Whatsapp?
If you could kindly discuss this with me and give me a kick in the right direction, I'd be most grateful.
07-22-2013 09:13 AM
1) To listen for new email messages, use MessageService::messageAdded(). For SMS, it's SmsTransport::messageReceived(). For the other accounts in the Hub, there aren't any BlackBerry specific APIs for Twitter, Facebook, LinkedIn, etc... you'd need to explicitly integrate with the web APIs exposed by those services.
2) No - the Hub itself does not poll for / actively monitor the updates of all the apps that are accessible via the Hub. The information flow is actually the other way around, with apps updating the Hub with their updates. The unified list in the Hub is just a time sorted amalgamation of the individual lists of each of the individual apps.
3) See #1.
4) I think this one is covered in the answers to #1 and #2.
So those are the APIs, but currently, your app needs to be running in order to listen to these events. With headless apps being added to 10.2, you'll also get triggers to run in the background, to respond to some of these events. For others, you may need to request access to always run in the background, should your app have depencies on listeners for which we don't yet have headless background triggers.