in app billing - retrieve price from inApp in Android -


please, i'm getting crazy this.

i can make purchase 1 of testers i'm not been able retrieve price of product.

see, below code "connect":

    //binding service    bindservice(new intent("com.android.vending.billing.inappbillingservice.bind"),                     mserviceconn, context.bind_auto_create);      string base64encodedpublickey;      base64encodedpublickey = getstring(r.string.baseencodedpubkey);      // compute public key , store in base64encodedpublickey     mhelper = new iabhelper(this, base64encodedpublickey);      mhelper.startsetup(new iabhelper.oniabsetupfinishedlistener() {            public void oniabsetupfinished(iabresult result) {               if (!result.issuccess()) {                  // oh noes, there problem.                  log.d("tma setup billing", "problem setting in-app billing: " + result);               }                              // hooray, iab set up!                 else{                    log.d("tma setup billing", "ready sell! ok!! " + result);                    //get prices of inapps                   bundle teste = null;                   arraylist<string> teste1 = null;                    getinappsinfo(teste,teste1);                }            }         }); 

from code above, got ok message it's connecting...

the problem @ code below:

    //func syncr download prices private synchronized void getinappsinfo(final bundle queryskus,final arraylist<string> skulist) {     asynctask<void, void, string> task = new asynctask<void, void, string>() {          @override         public string doinbackground(void... params) {          arraylist<string> skulist = new arraylist<string>();                skulist.add(getstring(r.string.prod1_maistempo));                 bundle queryskus = new bundle();                queryskus.putstringarraylist("details_list", skulist);                string resposta = getstring(r.string.naodisp);                try {                   bundle skudetails = mservice.getskudetails(3, getpackagename(), "inapp", queryskus);      int response = skudetails.getint("response_code");     log.d("tma synch billing","response = " + response );     preco = preco + " " + response;     if (response == 0) {         log.d("tma synch billing","response = ok");         arraylist<string> responselist = skudetails.getstringarraylist("details_list");         (string thisresponse : responselist) {         jsonobject object = new jsonobject(thisresponse);         string sku = object.getstring("productid");         string price = object.getstring("price");         log.d("tma synch billing","sky e price: " + sku + " " + price);         if (sku.equals(getstring(r.string.prod1_maistempo))) resposta = price;                }             }         } catch (remoteexception e) {             // todo auto-generated catch block             log.d("tma synch billing","error remote: " + e.getmessage());             e.printstacktrace();         } catch (jsonexception e) {             // todo auto-generated catch block             e.printstacktrace();             log.d("tma synch billing","error json: " + e.getmessage());         }           return resposta;          }          @override         protected void onpostexecute(string result) {             preco = preco + " " + result;         }      };     task.execute(); } 

this funcion returning 5 > (billing_response_result_developer_error 5
invalid arguments provided api. error can indicate application not correctly signed or set in-app billing in google play, or not have necessary permissions in manifest)

but then, can, same device (and same testers friends), buy inapp sucesfully code:

    //yes button clicked, start buy activity                      bundle buyintentbundle;                     try {                         buyintentbundle = mservice.getbuyintent(3, getpackagename(),                                getstring(r.string.prod1_maistempo), "inapp", "buyer info");                          pendingintent pendingintent = buyintentbundle.getparcelable("buy_intent");                          startintentsenderforresult(pendingintent.getintentsender(),                                    1001, new intent(), integer.valueof(0), integer.valueof(0),                                integer.valueof(0));                      } catch (remoteexception e) {                         // todo auto-generated catch block                         e.printstacktrace();                         log.d("tma billing buy "," remote " + e.getmessage());                     } catch (sendintentexception e) {                         // todo auto-generated catch block                         e.printstacktrace();                         log.d("tma billing buy "," sendintent " + e.getmessage());                     } 

and then, handle json string examples google.

so, can tell me i'm doing wrong in function price? thank guys.

the bundle pass getskudetails has arraylist<string> key item_id_list, not details_list have (details_list arraylist<string> in response bundle)


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -