Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
257 views
in Technique[技术] by (71.8m points)

android - Restore Transactions in Google In-app Version 3

I have an app and its working fine now i want to implement restore transactions method in my app. I did not find this method now how can i can call or define or make other method to restore transaction in in-app version 3. I searched on net but did not find relevant sol or info.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can restore your transaction using the getPurchases() API

Bundle ownedItems = mService.getPurchases(3, mContext.getPackageName(),
                itemType, continueToken);

 ArrayList mySkus, myPurchases, mySignatures;
 mySkus = ownedItems.getStringArrayList(RESPONSE_INAPP_ITEM_LIST);
 myPurchases = ownedItems.getStringArrayList(RESPONSE_INAPP_PURCHASE_DATA_LIST);
 mySignatures = ownedItems.getStringArrayList(RESPONSE_INAPP_PURCHASE_SIGNATURE_LIST);

will list the items that you own and the corresponding data that you can use to verify the purchases.

While you make this call, be sure to

  1. Use the Google ID that you used to make the purchase.
  2. Not to use the STATIC Product IDs(android.test.purchased, android.test.refunded...). You can use the test-IDs that you created under your IAB test account.
  3. Use the appropriate product type and the package name of your app.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...