Tuesday, September 6, 2011

The new, improved Android app

Pulling an all-nighter on Sunday, I added the ability to change JLPT level numbers. The tricky thing was the validation logic, but I got around that by saving and exiting the settings page on a change of level, then updating it and pulling in the start/end quiz number for the level from preferences. Another problem was a black screen instead of the dialog box while waiting for the data download. This was remedied by adding a "start" screen which makes the call to the async thread, then calling the next activity when the thread was completed. Basically, have the calling activity execute the async method instead of the called activity - and run the called activity when the async thread is complete. Clever, no? So, I uploaded that up, and tested on 4 phones. Two worked fine - mine and another guy's at a cookout - one crashed at the beginning - I think it's something not supported in 2.1, but I forget what - and another worked, but unfortunately the custom font didn't show up. So, I've got the free version up and kind of running. Now, to get the paid version going on. There are a few things to sort out. The main thing is whether to use a library project again or not. Libraries pulling in libraries seems to lead to unresolvable conflicts, so I'm not going back to that. But, that means duplicate code, which is worse than anything. So I might have to give the library approach one more try. So, here's the list: 1. Change the core code back to a library. 2. Create the free version. 3. Get the app name working. 4. Get that change uploaded. 5. Create the paid version using the library 6. upload that. Ok, here goes. 1 was simple. 2 also was simple, as I just copied one of the old level-specific version. 3 was also simple, as it turns out the app name is in strings.xml under app_name or label, I believe. I can even use the boot activity from the library, since there's no extra functionality. But, let's see if we can get the paid version working before uploading it, as I want to refer to the pay version in a link in the demo version. Ok, after a bit of fussing around with package names and the BootStrapActivity (it needs its own in order to do the licensing logic) that one is running. But, the license is saying, no good. But, when I check the testing status on the marketplace account, it says licensed. So, where is the miss? Ok, reading the fine print reveals the issue:
Test Accounts Comma-separated list of additional Gmail addresses (aside from kanjisoft@gmail.com) that will get the License Test Response from applications you manage. These users will also be able to make in-app-billing purchases from uploaded, unpublished applications you manage. License Test Response This License Test Response will be sent to devices using [my name] @gmail.com or the Test Accounts listed above for applications you have uploaded to Market. Additionally, this account (but not the Test Accounts) will receive this response for applications that have not yet been uploaded to Market.
Since the app hasn't been uploaded yet, I need to be logged into that gmail account. Well, I have 3 accounts, Well, actually the problem is "missing permission" - which is strange considering I copied the project from one of the versions of the paid app. But the nag number is off too, so maybe not. Anyway, let's add back in the licensing permission:
Hmmm...I don't get it. There's a permission in there now, but I'm still getting the same error message. Also, it says running a different app name. Also, the title is wrong. Ah, right, I can upload the app without publishing it. Let's try that. Actually, this may be the answer:
Ok - that works - but now there's another problem. I'm now launching the start activity from the bootstrapactivity in the free version, whereas in the pay version I'm launching it from the validate routine. I'm not exactly sure why, but I know there was a reason. Actually, it all had to do with being unable to upload an application that had the license validation package installed. But, maybe it's just the permission? I would really like get to a single BootStrapActivity! Well, the short-term solution is to just keep the separate versions, and call the new async task which downloads the db and then launches the start activity from the validation routine on a successful validation - instead of the direct launch to start activity. So, it's kind of a strange thing - they both will have a push me/kick off the app button. Now, for the paid app, unlike before, the validation will start only after they press the push me button. It's kind of odd. But, that's how it's structured now, it's not going to kill anyone. Sugar. It got a permission denied, which sent it into some kind of a loop instead of display a message. Ah, I know; I'll just put the license validation before the button call. Well, then they'll still have the button they can push. Well, I just need to get that dialog properly displayed for now. Good, it came back to the display on an allow. Man. Just when I was getting on a roll, the free app is kicking up with an R error on the Modfox library. WTF. Ok, let's finish up the pad app, then we'll deal with all that. Change the test licensing anser to "not licensed", and it works great. What else do we need? I think we're good for now. Let's get it uploaded. And - we're back in the saddle again. Awe-some.

No comments:

Post a Comment