20

As per the given link: https://developers.google.com/wallet/objects/savetowalletnative

I am trying to run the sample application, but in this below method, I am not able to find CreateWalletObjectsRequest. It says:

"CreateWalletObjectsRequest cannot be resolved to a type"

public void saveToWallet(View view){

    LoyaltyWalletObject wob = generateObject();


    CreateWalletObjectsRequest request = new CreateWalletObjectsRequest(wob);
    Wallet.createWalletObjects(googleApiClient, request, SAVE_TO_WALLET);

}
Darth Hunterix
  • 1,484
  • 5
  • 27
  • 31
Manifest.xml
  • 201
  • 1
  • 5
  • 1
    Did you create LoyaltyWalletObject? If you create it, please will tell me how you created it? I have had same problem http://stackoverflow.com/questions/26467437/saving-offer-to-google-wallet . – Dima Oct 21 '14 at 10:50
  • 1
    this tutorial is not working https://developers.google.com/wallet/objects/savetowalletnative#obtain_credentials_and_a_client_id_for_your_app – Amir Qayyum Khan Mar 30 '15 at 05:51
  • Was anyone successful importing CreateWalletObjectsRequest? – Monica M Mar 30 '15 at 12:32

2 Answers2

4

Google hasn't opened Save to Wallet api for everyone yet. We had to get a special Google Play Services AAR directly from Google, along with a lot of help from a Googler to get it functioning (the sample is out of date).

dandc87
  • 1,096
  • 5
  • 7
1

As of now, you'll need to work with your Google contact to get the second-party library to integrate Android Pay. Once you get the aar file, you can import it into your project and add it as a dependency.

Now, the 'createWalletObjects' method call in your question has shifted in its location and signature; its now as follows:

Wallet.WalletObjects.createWalletObjects(googleApiClient, request, SAVE_TO_WALLET);

The SAVE_TO_WALLET is the integer request code that you'll identify the request in your onActivityResult(). Creating the request as such is described in the "Create an object" section of https://developers.google.com/save-to-android-pay/guides/android/add-button-to-your-app