|
Copyright 2008 Motorola Inc. and Nokia Corporation. All Rights Reserved. Specification License |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.microedition.broadcast.purchase.SubscriptionManager
public class SubscriptionManager
The SubscriptionManager
is used to manage purchase settings and existing subscriptions.
Purchasing is done by either getting a list of available purchase bundles via getAllPurchaseObjects()
,
or by querying the purchase options for individual program events or services via getPurchaseObjects(String id)
.
The id
of a program event or service is obtained from a ProgramEvent
or Service
, respectively.
Purchase bundle is a collection of services or program events or both that can purchased by a single purchase transaction.
Purchase bundle is represented by a PurchaseObject
.
The incomplete code snippet below shows how to get a PurchaseObject
for selected service for purchase.
It is assumed that the implementation supports
CommonMetadataSet.SERVICE_ID
attribute.
Similarly, theService service; // getting the service from the ESG ... String serviceId = service.getStringValue(CommonMetadataSet.SERVICE_ID); PurchaseObjects[] purchaseObjects = SubscriptionManager.getPurchaseObjects(serviceId);
PurchaseObject
s for ProgramEvent
s can be get by passing the
CommonMetadataSet.PROGRAM_ID
to
the getPurchaseObjects(String id)
method.
Existing subscriptions can be queried by getSubscriptions()
. Method returns a list of
PurchaseObject
s that identify the purchased services.
In order to see what exactly the purchase or subscription contains the application can fetch the services
and programs from the PurchaseObject
String[] servicesIDs = purchaseObjects[0].getStringValues(CommonMetadataSet.SERVICE_ID); String[] programIDs = purchaseObjects[0].getStringValues(CommonMetadataSet.PROGRAM_ID);
SubscriptionManager
specifies two PlayerListener
events to indicate Player
s
about Rights Object related issues. More comprehensive explanation about them is found from
Security, DRM and Purchasing Specification.
Purchasing functionality can't be guaranteed to work all the time, or at all. On some platforms purchasing maybe is not applicable
at all. It's also possible that, for instance, change of platform provider affects the purchasing functionality.
SubscriptionManager
methods will always work but occasionally methods returning arrays may return an empty array
and getDefaultPurchaseChannel()
may return null
.
microedition.broadcast.supports.purchasing
can be used
to query if purchasing is supported or not.
If purchasing is not supported then
microedition.broadcast.supports.purchasing
returns false
.
UnsupportedOperationException
when called
Field Summary | |
---|---|
static java.lang.String |
NO_RIGHTS
Posted to a PlayerListener when Player is trying to play content
that the application has no rights to. |
static java.lang.String |
RIGHTS_UPDATED
Posted to a PlayerListener when the Rights Object associated to
the Service or ProgramEvent used by the Player
has been updated. |
Method Summary | |
---|---|
static PurchaseObject[] |
getAllPurchaseObjects()
Get all available PurchaseObject s. |
static java.lang.String |
getDefaultPurchaseChannel()
Get the channel of the default purchase system used for purchase requests. |
static PurchaseObject[] |
getPurchaseObjects(java.lang.String id)
Get all PurchaseObjects to purchase a Service or ProgramEvent
It may be possible to purchase the service via multiple service bundles so multiple PurchaseObject s
may be returned. |
static PurchaseObject[] |
getSubscriptions()
Get purchased subscriptions. |
static java.lang.String[] |
getSupportedPurchaseChannels()
Get the supported purchase channels. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String NO_RIGHTS
PlayerListener
when Player
is trying to play content
that the application has no rights to.
public static final java.lang.String RIGHTS_UPDATED
PlayerListener
when the Rights Object associated to
the Service
or ProgramEvent
used by the Player
has been updated.
Method Detail |
---|
public static PurchaseObject[] getAllPurchaseObjects() throws UnsupportedOperationException
PurchaseObject
s. The returned list may contain already purchased
PurchaseObject
s.
PurchaseObject
s.
UnsupportedOperationException
- if purchasing is not supported.public static java.lang.String getDefaultPurchaseChannel() throws UnsupportedOperationException
PurchaseObject
s returned by SubscriptionManager
use the current default
purchase channel. Default purchase channel may change over time, for instance, because the platform
provider is changed.
null
if purchasing is supported but for some reason
the default purchase channel is currently not known.
UnsupportedOperationException
- if purchasing is not supported.public static PurchaseObject[] getPurchaseObjects(java.lang.String id) throws UnsupportedOperationException
Service
or ProgramEvent
It may be possible to purchase the service via multiple service bundles so multiple PurchaseObject
s
may be returned.
id
- the SERVICE_ID
or
the PROGRAM_ID
of the Service
or ProgramEvent
, respectively, to be purchased.
PurchaseObject
s containing the required Service
or ProgramEvent
.
java.lang.NullPointerException
- if id
is null
.
java.lang.IllegalArgumentException
- if id
is not valid.
UnsupportedOperationException
- if purchasing is not supported.public static PurchaseObject[] getSubscriptions() throws UnsupportedOperationException, java.lang.SecurityException
PurchaseObject
s containing purchased services.
UnsupportedOperationException
- if purchasing is not supported.
java.lang.SecurityException
- if user has no rights to query subscriptions.public static java.lang.String[] getSupportedPurchaseChannels() throws UnsupportedOperationException
UnsupportedOperationException
- if purchasing is not supported.
|
Copyright 2008 Motorola Inc. and Nokia Corporation. All Rights Reserved. Specification License |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |