Friday, 15 February 2013

android - i want to use shared preference in the onpurchaseresponse() of SamplepurchaseListener.java of inapppurchasing via amazon -


When the case is successful I want to edit the variable value and then I use this value in the other class of this project Want to do How can I do this? Please suggest me

  switch (position) {Successful case: sample buy buyer.ir.on.UETread (new runaball) {@ Override Public Wide Run () {// TODO auto-generated method stub SharedPreferences .Editor Editor = getSharedPreferences (MY_PREFS_NAME, MODE_WORLD_READABLE) .itit (); Editor.putBoolean ("PREMIUM", true); // Storeing Boolean - true / incorrect editor codeit ();}}); Final Receipt Receipt = Response Forgot space (); IapManager.setAmazonUserId (response.getUserData (). GetUserId (), response.getUserData (). GetMarketplace ()); Log D. (Tag, "Shopping Rashpen: Receipt Jason:" + Receipt.Tojone ()); IapManager.handleReceipt (response.getRequestId () .toString (), receipt, response.getUserData ()); IapManager.refreshLevel2Availability (); break; Cases ALREADY_PURCHASED: Log.i (tag, "purchase rationes: have already been bought, you should confirm the entitlement purchase on your behalf and make sure that the purchase was given to the customer"); break;  

If you want to get value from another class, why not just preference From? Something like this:

Shared References sp = getSharedPreferences (MY_PREFS_NAME, MODE_WORLD_READABLE); Boolean Premium = sp.getBoolean ("Premium", Incorrect); If (premium) {...

If there is no value, it has already been archived, the method will return "false". I probably have not explained your question.


No comments:

Post a Comment