Tecnologia do Blogger.
RSS

Re: [androidbrasil-dev] Sobre in-app Billing

É estou com a apk no console e os produtos cadastrados e ativos desde as 11hs da manhã.

Já procurei no google todo, mas continuo com a mesma bronca.

mHelper.launchPurchaseFlow(MainActivity.this, "g01", 10001,  mPurchaseFinishedListener, "");


o metodo de mPurchaseFinishedListener onde tem as verificações coloquei Log.v mas nada





2014-03-26 15:12 GMT-03:00 Marcel <marsky.al@gmail.com>:
opa corrigindo fiz o upload da apk


2014-03-26 15:03 GMT-03:00 Neto Lobo <desilio@gmail.com>:

Para testar não precisar publicar só por como rascunho já serve.


On Wed, Mar 26, 2014 at 2:52 PM, Marcel <marsky.al@gmail.com> wrote:
no android studio tive que gerar uma chave pq senão nem publicar eu consigo. E coloquei a chave da app que peguei no console.

Fiz assim.

coloquei a permission no manifest,


setei no gradle o caminho para o arquivo IInAppBillingService.aidl, que verifiquei que compilou normal.
copiei a pasta util do exemplo que vem na sdk


e o main ficou assim:

public class MainActivity extends ActionBarActivity {
    final String TAG = "achix";
    IabHelper mHelper;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        Log.d(TAG, "This is the begin, my only friend. The begin.");

        String base64EncodedPublicKey = "chave da aplicacao";

        // compute your public key and store it in base64EncodedPublicKey
        mHelper = new IabHelper(this, base64EncodedPublicKey);

        mHelper.startSetup(new IabHelper.OnIabSetupFinishedListener() {
            public void onIabSetupFinished(IabResult result) {
                if (!result.isSuccess()) {
                    // Oh noes, there was a problem.
                    Log.d(TAG, "Problem setting up In-app Billing: " + result);
                }
                // Hooray, IAB is fully set up!
                List additionalSkuList = new ArrayList();
                additionalSkuList.add("g01");
                additionalSkuList.add("g02");

                IabHelper.QueryInventoryFinishedListener mQueryFinishedListener = new IabHelper.QueryInventoryFinishedListener() {
                    public void onQueryInventoryFinished(IabResult result, Inventory inventory) {
                        if (result.isFailure()) {
                            // handle error
                            return;
                        }

                        String applePrice = inventory.getSkuDetails("g01").getPrice();
                        String bananaPrice = inventory.getSkuDetails("g02").getPrice();

                        // update the UI
                        Log.d(TAG, applePrice + " - " + bananaPrice);
                    }
                };

                mHelper.queryInventoryAsync(true, additionalSkuList, mQueryFinishedListener);

                final IabHelper.OnIabPurchaseFinishedListener mPurchaseFinishedListener = new IabHelper.OnIabPurchaseFinishedListener() {
                    public void onIabPurchaseFinished(IabResult result, Purchase purchase) {
                        if (result.isFailure()) {
                            Log.d(TAG, "Erro na compra: " + result);
                            return;
                        }
                        else if (purchase.getSku().equals("g01")) {
                            // consume the gas and update the UI
                            Log.d(TAG, "Comprado e comprado bunito.");
                        }
                        //else if (purchase.getSku().equals(SKU_PREMIUM)) {
                        // give user access to premium content and update the UI
                        //}
                    }
                };

                Button btCompra = (Button) findViewById(R.id.bt_compra);
                btCompra.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        mHelper.launchPurchaseFlow(MainActivity.this, "g01", 10001,  mPurchaseFinishedListener, "bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ");
                    }
                });

            }
        });

        /*
        Log.d(TAG, "Compra.");
        IabHelper.OnIabPurchaseFinishedListener mPurchaseFinishedListener = new IabHelper.OnIabPurchaseFinishedListener() {
            public void onIabPurchaseFinished(IabResult result, Purchase purchase) {
                if (result.isFailure()) {
                    Log.d(TAG, "Erro na compra: " + result);
                    return;
                }
                else if (purchase.getSku().equals("g01")) {
                    // consume the gas and update the UI
                    Log.d(TAG, "Comprado e comprado bunito.");
                }
                //else if (purchase.getSku().equals(SKU_PREMIUM)) {
                // give user access to premium content and update the UI
                //}
            }
        };
        mHelper.launchPurchaseFlow(this, "g01", 10001,  mPurchaseFinishedListener, "bGoa+V7g/yqDXvKRqq+JTFn4uQZbPiQJo4pf9RzJ");
*/
        Log.d(TAG, "This is the end, my only friend. The end.");
    }

    @Override
    public void onDestroy() {
        super.onDestroy();
        if (mHelper != null) mHelper.dispose();
        mHelper = null;
    }


}










2014-03-26 14:45 GMT-03:00 Neto Lobo <desilio@gmail.com>:

Você assinou apk, tem que assinar.

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


--
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário