IAP Sample Program

pendranpendran Posts: 9Member
edited January 2013 in ODK (OUYA Developer Kit)
Hey guys,
i just tried to install and run the sample program by following the instructions in the README.txt. But at point 3 i ran into some problems, as the tests would fail. Now, i took me a while to figure out why it would always fail, but i finally managed to locate the bug: (please note, that i am located in germany, i guess that people who are located in countries that use the same number format as the US-Citizens do not run into this problem)

Problem is: The output string that is produced by Strings.formatDollarAmount(product.getPriceInCents()) does not work properly for my localisation (and i believe for many others as well). Furthermore, the imported packages in IapSampleActivity.java and (i believe it was) StringsTest.java do not refer to the included tv.ouya.sample.util.Strings.java.

Solution is: Import the correct class and change the Strings.formatDollarAmount(int amount) method to properly instanciate like this: NumberFormat.getCurrencyInstance(Locale.US)

I was very confused that this topic has not shown up here already, so i guess i either overlooked it or the maybe the problem has already been fixed?
However, i hope that this information is useful for anybody at least.
Sincerly yours,
Fabian
Post edited by pendran on

Comments

  • pendranpendran Posts: 9Member
    edited January 2013
    Hey guys,
    now I need your help. I just started with all of this android, ouya thing a few days ago and therefor I am not that experienced. Still I am stuck with this sample app, although there are no more failures after ant clean test the app is not working properly, as the buttons won't perform any actions when pressed.
    More precisely the methods ouyaFacade.requestPurchase(...) and ouyaFacade.requestGamerUuid(...) don't work. Here is the LogCat output that occurs if the gamer uuid button is pressed:

    01-05 18:43:33.360: E/JavaBinder(1247): *** Uncaught remote exception!  (Exceptions are not yet supported across processes.)
    01-05 18:43:33.360: E/JavaBinder(1247): android.content.ActivityNotFoundException: Unable to find explicit activity class {tv.ouya/tv.ouya.console.service.iap.ui.GamerUuidActivity}; have you declared this activity in your AndroidManifest.xml?
    01-05 18:43:33.360: E/JavaBinder(1247): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1541)
    01-05 18:43:33.360: E/JavaBinder(1247): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1416)
    01-05 18:43:33.360: E/JavaBinder(1247): at android.app.ContextImpl.startActivity(ContextImpl.java:891)
    01-05 18:43:33.360: E/JavaBinder(1247): at android.app.ContextImpl.startActivity(ContextImpl.java:880)
    01-05 18:43:33.360: E/JavaBinder(1247): at android.content.ContextWrapper.startActivity(ContextWrapper.java:276)
    01-05 18:43:33.360: E/JavaBinder(1247): at tv.ouya.console.service.iap.IapService$1.requestGamerUuid(IapService.java:73)
    01-05 18:43:33.360: E/JavaBinder(1247): at tv.ouya.console.internal.IIapServiceDefinition$Stub.onTransact(IIapServiceDefinition.java:102)
    01-05 18:43:33.360: E/JavaBinder(1247): at android.os.Binder.execTransact(Binder.java:367)
    01-05 18:43:33.360: E/JavaBinder(1247): at dalvik.system.NativeStart.run(Native Method)

    Edit: Maybe I should mention, that I don't have the console atm and everything runs on an emulator.
    Post edited by pendran on
  • BuddyBuddy Posts: 183Member
    Have you installed ouya-framework.apk?
    Cheers!
  • pendranpendran Posts: 9Member
    Hi,
    yes I installed the framework. I just reinstalled the framework and the app, but still doesn't work =(
    I guess I will try to wipe out all data from the emulator and try it again from scratch later, after I finished my daily duties :D
    If anyone comes up with anything, please post ;)
  • alsuttonalsutton Posts: 69Member, Team OUYA
    We're looking to release a new ODK in the new few days which will address issues some people have seen like this, if you can hold off developing in those areas for a couple of days you'll save yourself some pain :).
    Al Sutton
    Android Specialist
    OUYA
  • pendranpendran Posts: 9Member
    Well, sounds good to me :)
  • BuddyBuddy Posts: 183Member
    Fixed the NumberFormat.getCurrencyInstance(Locale.US) thing as well -- thanks for the feedback!
  • stolkstolk Posts: 119Member
    When I try the IAP sample, I get 'invalid app UUID'.
    Even though I copied it from the website, and pasted it into the java source.
    I also created the 3 products.

    Note that the instructions in README.txt and the instructions in the source of IapSampleActivity.java contradict each other!
    From the readme:

    1. Login to the Developer Portal at https://developer.ouya.tv and make a note of your developer UUID:
    2. Navigate to Products and add two or more products.  For at least one of these products, the product identifiers should start with "__DECLINED__"
    3. Find and edit the following file: src => java => tv => ouya => sample => IapSampleActivity.java
     - Change DEVELOPER_ID to match the UUID that you noted from the Developer Portal.
     - Remove the existing strings from PRODUCT_IDENTIFIER_LIST and update it with the list of product identifiers you created in step 2 of this section.  They must match the product identifiers you defined in the Developer Portal exactly.

    And then in the source code itself:

        /**
         * Log onto the developer website (you should have received a URL, a username and a password in email)
         * and get your developer ID. Plug it in here. Use your developer ID, not your developer UUID.
         * <p/>
         * The current value is just a sample developer account. You should change it.
         */

    From the TTY log, I see that the app still manages to retrieve the list of products.

    I/ActivityManager(  311): START {cmp=tv.ouya.console/.launcher.store.AppDetailsActivity (has extras) u=0} from pid 502
    D/inAppPurchase(  502): Binding to StoreService
    D/inAppPurchase(  502): Successfully bound to IapService
    D/IAP Client Service(  543): Getting from URL: https://devs.ouya.tv/api/v1/apps/null
    I/ActivityManager(  311): Displayed tv.ouya.console/.launcher.store.AppDetailsActivity: +79ms
    E/BufferQueue(  108): [tv.ouya.console/tv.ouya.console.launcher.AppsActivity] drainQueueLocked: BufferQueue has been abandoned!
    D/IAP Client Service(  543): Got response with code: 400
    D/IAP Client Service(  543): Response body was: {"error":{"code":2005,"message":"Invalid app Uuid was provided"}}
    D/IAP Client Service(  543): Response body was: {"error":{"code":2005,"message":"Invalid app Uuid was provided"}}
    E/IapGateway(  543): Got failure response with message: {"error":{"code":2005,"message":"Invalid app Uuid was provided"}}
    I/ActivityManager(  311): START {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] pkg=tv.ouya.sample cmp=tv.ouya.sample/.IapSampleActivity u=0} from pid 502
    D/inAppPurchase( 3291): Binding to IapService
    D/inAppPurchase( 3291): Successfully bound to IapService
    D/dalvikvm(  543): WAIT_FOR_CONCURRENT_GC blocked 0ms
    D/dalvikvm(  543): GC_EXPLICIT freed 1045K, 13% free 20221K/23175K, paused 2ms+12ms, total 59ms
    D/IapGateway(  543): requesting product list
    I/ActivityManager(  311): START {flg=0x18000000 cmp=tv.ouya/.console.service.iap.ui.IapReceiptActivity (has extras) u=0} from pid 543
    I/dalvikvm-heap(  311): Grow heap (frag case) to 44.202MB for 8294416-byte allocation
    D/dalvikvm(  311): GC_CONCURRENT freed 10075K, 47% free 30038K/56647K, paused 15ms+6ms, total 61ms
    D/IapGateway(  543): requesting receipts
    I/dalvikvm-heap(  543): Grow heap (frag case) to 32.717MB for 8294416-byte allocation
    D/dalvikvm(  543): GC_CONCURRENT freed 8748K, 38% free 19609K/31303K, paused 14ms+3ms, total 39ms
    I/ActivityManager(  311): Displayed tv.ouya.sample/.IapSampleActivity: +334ms
    E/IAP Client Service(  543): Receipt list failure: 2001 message: Unable to get an authentication token from the server.
    W/IapSample( 3291): Request Receipts error (code 2001: Unable to get an authentication token from the server.)
    W/InputMethodManagerService(  311): Focus gain on non-focused client com.android.internal.view.IInputMethodClient$Stub$Proxy@42b657e0 (uid=10032 pid=543)
    I/ActivityManager(  311): Activity reported stop, but no longer stopping: ActivityRecord{42baa438 tv.ouya.sample/.IapSampleActivity}
    I/ActivityManager(  311): Displayed tv.ouya/.console.service.iap.ui.IapReceiptActivity: +348ms
    D/IAP Client Service(  543): Got response with code: 200
    D/IAP Client Service(  543): Response body was: {"products":[{"identifier":"__DECLINED__THIS_PURCHASE","name":"DECLINED","priceInCents":100},{"identifier":"sharp_axe","name":"Sharp Axe","priceInCents":100},{"identifier":"long_sword","name":"Long Sword","priceInCents":100}]}
    D/IapGateway(  543): received success response
    D/IAP Client Service(  543): Response body was: {"products":[{"identifier":"__DECLINED__THIS_PURCHASE","name":"DECLINED","priceInCents":100},{"identifier":"sharp_axe","name":"Sharp Axe","priceInCents":100},{"identifier":"long_sword","name":"Long Sword","priceInCents":100}]}
    D/IapGateway(  543): response body: {"products":[{"identifier":"__DECLINED__THIS_PURCHASE","name":"DECLINED","priceInCents":100},{"identifier":"sharp_axe","name":"Sharp Axe","priceInCents":100},{"identifier":"long_sword","name":"Long Sword","priceInCents":100}]}
    D/IAP Client Service(  543): Response body was: {"products":[{"identifier":"__DECLINED__THIS_PURCHASE","name":"DECLINED","priceInCents":100},{"identifier":"sharp_axe","name":"Sharp Axe","priceInCents":100},{"identifier":"long_sword","name":"Long Sword","priceInCents":100}]}
    D/SyncManager(  311): failed sync operation stolk (tv.ouya.account.v1), tv.ouya.user.keys, PERIODIC, earliestRunTime 94055589, SyncResult: stats [ numIoExceptions: 1]
  • stolkstolk Posts: 119Member
    My Error 2005 went away after upgrading to latest firmware.
  • JSIDDJSIDD Posts: 167Member
    @alsutton Is IAP Sample Program "Request Gamer UUID" button supposed to work now with the latest firmware/sdk (January 13)? I got this error: unable to fetch gamer uuid (error 2011: unable to get an authentication token from the server). Is it because I am already logged in on the console with my dev account?

    @pendran Is it working for you now?

  • pendranpendran Posts: 9Member
    I haven't tested it entirely, and I also switched back to an older framework and launcher version, as the new one seems to have some annoying issues (can't access the ouya application on my android device manually, because it wants me to login, which never works).
    But what I recall from the short time I used the new framework+launcher was:
    Most of the functionality worked for me, I could click on products and a purchase dialogue would open, I could request the gamer uuid via the button... however, products I should have "bought" would never appear in the list of purchased products, but I did not spend much time to figure out the problem behind that, as I need to go to the university again :D
  • VoodooDoubloonVoodooDoubloon Posts: 84Member
    Weird Im having the same error 2005 UUID error and installed fine via browser download. Could it be the way I installed the apk through browser?
Sign In or Register to comment.