Code example for Context

Methods: getPackageNamestartService

0
 
	private static IMarketBillingService mService;
 
	public static void checkBillingSupported(Context context) {
		final Intent intent = createIntent(context, Action.CHECK_BILLING_SUPPORTED);
		context.startService(intent);
	} 
 
	public static void checkSubscriptionSupported(Context context) {
		final Intent intent = createIntent(context, Action.CHECK_SUBSCRIPTION_SUPPORTED);
		context.startService(intent);
	} 
	 
	public static void confirmNotifications(Context context, String[] notifyIds) {
		final Intent intent = createIntent(context, Action.CONFIRM_NOTIFICATIONS);
		intent.putExtra(EXTRA_NOTIFY_IDS, notifyIds);
		context.startService(intent);
	} 
 
	private static Intent createIntent(Context context, Action action) {
		final String actionString = getActionForIntent(context, action);
		final Intent intent = new Intent(actionString);
		intent.setClass(context, BillingService.class);
		return intent;
	} 
 
	private static final String getActionForIntent(Context context, Action action) {
		return context.getPackageName() + "." + action.toString();
	} 
 
	public static void getPurchaseInformation(Context context, String[] notifyIds, long nonce) {
		final Intent intent = createIntent(context, Action.GET_PURCHASE_INFORMATION);
		intent.putExtra(EXTRA_NOTIFY_IDS, notifyIds);