BlackBerryProfile

#include <bb/platform/identity/BlackBerryProfile>

To link against this class, add the following line to your .pro file: LIBS += -lbbplatform

Use BlackBerry profile as an identity provider, and provide off-device data storage.

BlackBerry profile is an identity provider that allows access to off-device, encrypted storage space. The storage space is bound to the BlackBerry ID user that is currently logged in. The storage is accessible remotely from all devices logged in with the same BlackBerry ID user, allowing applications installed on multiple devices access to the same information.

IDS API support

BlackBerry profile supports the following IdentityServiceProvider functions. Using BlackBerry profile with other functions will result in errors.
  • createData()

  • requestData()

  • setData()

  • deleteData()

  • listData()

  • setNotification()

Off-device data storage and retrieval APIs

Applications can use the APIs to securely store data in, and retrieve data from, the BlackBerry ecosystem. APIs are provided for storing data initially (createData()), retrieving the data (requestData()), updating the data (setData()), and removing the data (deleteData()).

Permissions

In order to store and retrieve data off of the device, wireless data is consumed. Applications using storage from BlackBerry profile must have the access_internet permission included in their bar descriptor file.

Limits to storage capacity

There's a limit to the amount of off-device storage that is available to each of your users. Storage limits are set according to user and app vendor, and apply to all of the apps that a user might have with a single vendor. For example, if you have multiple apps that require off-device storage, and you have a user who makes use of three of those apps, that user's storage limit applies to the total amount of storage space that those three apps require. Users can have multiple storage allocations, one for each app vendor.

Data usage

In order to store and retrieve data off of the device, wireless data is consumed. Applications using storage from BlackBerry profile must have the "Internet" permission included in their bar descriptor file.

Caching

In cases where the application may need data stored locally for quick or repeated access, the value can be cached securely on the device and retrieved on demand, even when not connected to the remote storage copy. The cache is synchronized with the remote copy so that the cache is always up to date while the device has appropriate data coverage.

Using profile storage

Create - Store a new entry

Call createData() to store new profile entries.

Set - Update an entry

Call setData() to update profile entries.

Get - Retrieve an entry

Call requestData() to retrieve profile entries.

Delete - Remove an entry

Call deleteData() to remove profile entries.

Get - List available entries

Call listData() to list profile entries.

Notifications

Notifications can be registered for entries either before or after they have been created. In cases where the registration is done after creation, the application is notified each time the value changes so that it can perform any necessary operations. If registration is done before an entry is created, the application is notified upon creation of the value as if it were an update. Additionally, registered applications receive a change notification when an entry is deleted.

To register for profile entry change notifications, call setNotification().

Each time a registered entry changes, the registered callback function is executed and the corresponding ids_bbprofile_notification indicates the kind of change that occurred.

Sample code for using BlackBerryProfile as the identity provider for your app

The following sample shows how to a list of user data stored for an application:

Make sure to include the following header files in your application

#include <bb/platform/identity/IdentityServiceProvide>
#include <bb/platform/identity/IdentityServiceResult>
#include <bb/platform/identity/IdentityServicePropertyResult>
#include <bb/platform/identity/BlackBerryProfile>
#include <bb/platform/identity/BlackBerryProfilePropertyType>
#include <bb/platform/identity/BlackBerryProfileListDataFlags>

Step 1 - Create an IdentityServiceProvider instance.

IdentityServiceProvider *provider = new IdentityServiceProvider( BlackBerryProfile::providerName(), this );
if( !provider->isValid() ) {
       qWarning << "Unable to communicate with BlackBerryProfile Provider: " << provider->error();
}

Step 2 - Connect with with success and failure signals.

QObject::connect( provider, SIGNAL( dataListRetrieved( int, QStringList ) ),
                       this, SIGNAL( dataListed( int, QStringList ) ) );

QObject::connect( provider, SIGNAL( dataListFailed( int, bb::platform::identity::IdentityServicePropertyResult::Type, QString ) ),
                       this, SLOT( listDataFail( int, bb::platform::identity::IdentityServicePropertyResult::Type, QString ) ) );

Step 3 - Call API's

IdentityServiceResult::Type result = provider->listData( BlackBerryProfilePropertyType::Application,
                                                               BlackBerryProfileListDataFlag::Default );
if( result != IdentityServiceResult::Success ){
       qWarning << "Unable to retrieve data list: " << result;
}


Overview

Properties Index

Public Functions Index

BlackBerryProfile (QObject *parent=0)
virtual ~BlackBerryProfile ()

Static Public Functions Index

Properties

QString providerName[read-only]

The identity provider name of BlackBerry ID to use with the.

See also:

IdentityServiceProvider class.

Public Functions

BlackBerryProfile (

Constructs an empty BlackBerryProfile instance.

Parameters
parent

The parent object. Setting parent to 0 constructs an BlackBerryProfile instance with no parent.

virtual~BlackBerryProfile ()

Destructor.

Static Public Functions

QString providerName ()

The identity provider name of BlackBerry Profile to use with the.

See also:

IdentityServiceProvider class.

Return:

The string name of the BlackBerry Profile provider.

Last modified: 2014-03-13

comments powered by Disqus