C# Класс Billing.BillingService

Наследование: Android.App.Service, Android.Content.IServiceConnection
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
BillingService ( ) : System
CheckBillingSupportedMethod ( string itemType ) : bool

Checks if in-app billing is supported. @pram itemType Either Consts.ITEM_TYPE_INAPP or Consts.ITEM_TYPE_SUBSCRIPTION, indicating the type of item support is being checked for.

HandleCommand ( Android.Content.Intent intent, int startId ) : void

The BillingReceiver sends messages to this service using intents. Each intent has an action and some extra arguments specific to that action.

OnBind ( Android.Content.Intent intent ) : IBinder

We don't support binding to this service, only starting the service.

OnServiceConnected ( ComponentName name, IBinder service ) : void

This is called when we are connected to the MarketBillingService. This runs in the main UI thread.

OnServiceDisconnected ( ComponentName name ) : void

This is called when we are disconnected from the MarketBillingService.

OnStart ( Android.Content.Intent intent, int startId ) : void
RequestPurchaseMethod ( string productId, string itemType, string developerPayload ) : bool

Requests that the given item be offered to the user for purchase. When the purchase succeeds (or is canceled) the BillingReceiver receives an intent with the action Consts#ACTION_NOTIFY. Returns false if there was an error trying to connect to Android Market.

RestoreTransactionsMethod ( ) : bool

Requests transaction information for all managed items. Call this only when the application is first installed or after a database wipe. Do NOT call this every time the application starts up.

Unbind ( ) : void

Unbinds from the MarketBillingService. Call this when the application terminates to avoid leaking a ServiceConnection.

Приватные методы

Метод Описание
BindToMarketBillingService ( ) : bool

Binds to the MarketBillingService and returns true if the bind succeeded.

CheckBillingSupportedMethod ( ) : bool
CheckResponseCode ( long requestId, Consts responseCode ) : void

This is called when we receive a response code from Android Market for a request that we made. This is used for reporting various errors and for acknowledging that an order was sent to the server. This is NOT used for any purchase state changes. All purchase state changes are received in the BillingReceiver and passed to this service, where they are handled in #purchaseStateChanged(int, String, String).

ConfirmNotificationsMethod ( int startId, string notifyIds ) : bool

Confirms receipt of a purchase state change. Each {@code notifyId} is an opaque identifier that came from the server. This method sends those identifiers back to the MarketBillingService, which ACKs them to the server. Returns false if there was an error trying to connect to the MarketBillingService.

GetPurchaseInformationMethod ( int startId, string notifyIds ) : bool

Gets the purchase information. This message includes a list of notification IDs sent to us by Android Market, which we include in our request. The server responds with the purchase information, encoded as a JSON string, and sends that to the BillingReceiver in an intent with the action Consts#ACTION_PURCHASE_STATE_CHANGED. Returns false if there was an error trying to connect to the MarketBillingService.

PurchaseStateChanged ( int startId, string signedData, string signature ) : void

Verifies that the data was signed with the given signature, and calls ResponseHandler#purchaseResponse(Context, PurchaseState, String, String, long) for each verified purchase.

RunPendingRequests ( ) : void

Runs any pending requests that are waiting for a connection to the service to be established. This runs in the main UI thread.

Описание методов

BillingService() публичный Метод

public BillingService ( ) : System
Результат System

CheckBillingSupportedMethod() публичный Метод

Checks if in-app billing is supported. @pram itemType Either Consts.ITEM_TYPE_INAPP or Consts.ITEM_TYPE_SUBSCRIPTION, indicating the type of item support is being checked for.
public CheckBillingSupportedMethod ( string itemType ) : bool
itemType string
Результат bool

HandleCommand() публичный Метод

The BillingReceiver sends messages to this service using intents. Each intent has an action and some extra arguments specific to that action.
public HandleCommand ( Android.Content.Intent intent, int startId ) : void
intent Android.Content.Intent the intent containing one of the supported actions
startId int an identifier for the invocation instance of this service
Результат void

OnBind() публичный Метод

We don't support binding to this service, only starting the service.
public OnBind ( Android.Content.Intent intent ) : IBinder
intent Android.Content.Intent
Результат IBinder

OnServiceConnected() публичный Метод

This is called when we are connected to the MarketBillingService. This runs in the main UI thread.
public OnServiceConnected ( ComponentName name, IBinder service ) : void
name ComponentName
service IBinder
Результат void

OnServiceDisconnected() публичный Метод

This is called when we are disconnected from the MarketBillingService.
public OnServiceDisconnected ( ComponentName name ) : void
name ComponentName
Результат void

OnStart() публичный Метод

public OnStart ( Android.Content.Intent intent, int startId ) : void
intent Android.Content.Intent
startId int
Результат void

RequestPurchaseMethod() публичный Метод

Requests that the given item be offered to the user for purchase. When the purchase succeeds (or is canceled) the BillingReceiver receives an intent with the action Consts#ACTION_NOTIFY. Returns false if there was an error trying to connect to Android Market.
public RequestPurchaseMethod ( string productId, string itemType, string developerPayload ) : bool
productId string an identifier for the item being offered for purchase
itemType string Either Consts.ITEM_TYPE_INAPP or Consts.ITEM_TYPE_SUBSCRIPTION, indicating /// the type of item type support is being checked for.
developerPayload string a payload that is associated with a given /// purchase, if null, no payload is sent
Результат bool

RestoreTransactionsMethod() публичный Метод

Requests transaction information for all managed items. Call this only when the application is first installed or after a database wipe. Do NOT call this every time the application starts up.
public RestoreTransactionsMethod ( ) : bool
Результат bool

Unbind() публичный Метод

Unbinds from the MarketBillingService. Call this when the application terminates to avoid leaking a ServiceConnection.
public Unbind ( ) : void
Результат void