1

I'm trying to find a way to enable an Android Wear companion app only if the user has purchased it via an in-app purchase on their mobile device.

1) Is this possible?

2) How is it done?

Michael Garner
  • 1,042
  • 1
  • 10
  • 19
  • You can't prevent the wearable APK being synced to the watch, so you need to verify if the user has "purchased" the wearable module when they try to launch it. Here are a couple of ideas to try: 1) when the wearable module launches (i.e. in WearableMainActivity.onCreate()), use mService.getPurchases() to check if the "wearable" product has been purchased. If so, display the normal UI; otherwise display a hint asking the user to purchase the module. 2) Perform the check in your mobile app, and sync the purchase state using the wearable data layer. (I'd try going down option (1) first). – Peter Friese Feb 10 '16 at 11:33
  • 1
    Turns out com.android.vending.billing.InAppBillingService is not available on Wear, so you'll have to use the second approach I suggested: perform purchase and product purchase verification on mobile, then use the DataLayer API to sync a flag that triggers whether the user may use the wearable app. – Peter Friese Feb 10 '16 at 12:11

1 Answers1

2

As you cannot prevent the wearable APK from being synced to the watch, you need to verify if the user has "purchased" the wearable module when they try to launch it.

Unfortunately, com.android.vending.billing.InAppBillingService is not available on Android Wear, so you'll have to do the following:

  1. Perform purchase and product purchase verification on mobile
  2. Use the DataLayer API so sync this information to the wearable module
  3. Use a WearableListenerService on the wearable to react to the purchase coming through and enabling the full set of features on the wearable module

When the user launches the wearable app before making the purchase, you should show them a friendly message and ask them to perform the purchase in the mobile app.

Peter Friese
  • 6,709
  • 31
  • 43