سؤال

I'm currently trying to use the BBM SDK 1.0 (net_rim_bb_qm_platform.jar). The integration works no problem, except when the device has a BBM version lower than 6, as per the library's requirements.

I'm wondering if there's some sort of "reflection" type of system I could use to test at startup whether to include the library, which I highly doubt. Or a way to restrict downloads on App World, i.e. if the device has BBM 5, download a version without BBM integration, else download the other.

هل كانت مفيدة؟

المحلول

First, you need to decide whether your app must have BBM, or if it can still run without BBM, in some degraded mode (fewer features). It sounds like your app can run without BBM, so I'll address that scenario:

Take a look a this documentation and sample code from R. Masroor on BlackBerry.com.

From the description (bold is mine):

The RIM supplied BBM dependency checker samples, provide two approaches to integrating with BBM.

a) The proxy method which is appropriate when the application will not run without BBM – it directs the user to download BBM.

b) By contrast, the interface method provides a way for an application to isolate itself from the BBM, so that the application can still run even if BBM is not installed.

Why is this isolation needed? Because if a cod (project) references any BBM methods, then BBM must on the device and at a suitable level before that cod can be loaded. So if an application directly references BBM and there is no BBM (or no suitable level of BBM) on the device, the application will not run.

Of the two approaches, the interface approach is probably the most useful, as most applications have functionality without BBM. But this approach has two disadvantages:

• It requires a start up process to register the RuntimeStore Object

• The layered approach and the use of call-backs makes this quite complicated for me.

The attached project demonstrates a variation on the interface method, that creates the interface object at Application start-up, using class.forName(). Aside from this change, the sample provided is similar to the interface method, and is explained below. After the explanation of the attached project, this document explains how to create a different structure which you may find easier to work with.

Also, for reference, you can take a look at the BBMSDKDemoProxy sample project that comes with the BBM SDK download.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top