Monday, December 31, 2012

signed .apk file and first in-app product

When I started my in-app billing testing with Android a little over a week ago, I got the test product working (android.test.purchased) and wanted to try my real products.  That led me to a long list of pre-requisites.  Before I could create an in-app product in the Google Developer Console, I first had to upload my .apk.  No problem, I thought.  I uploaded it and got an error that it was not "zip aligned".

Okay, so I did some reading and found the zipalign tool that you have to run on a .apk file before uploading. Fine, I ran the tool, uploaded again.  Now an error that my .apk is not signed.  Back to the documentation.

Before you can upload your .apk, it has to be complied in release mode and signed with a key.  All the documentation emphasizes doing this with command line tools, but it also can be done using a wizard in Eclipse.  You just right click on the project and choose Export.  The part about the keystore was still confusing to me, so I had to read  more about that.  After all the reading and trial and error that day, I basically gave up on it and worked on some other stuff.

But today I revisited it.  Reading about generating a keystore using the command line tools helped me to understand what was being asked for in the wizard in Eclipse.  I didn't get that it was asking me to create a new password-protected keystore file that then contains a separate key with its own password. So I finally got past that, got the .apk file signed, then zip aligned, and then uploaded it successfully to the Developer Console.  From there it was easy to make the first in-app product!

But now it's 5:30 on New Years Eve, so I'm calling it quits! Happy New Year!

First iOS users

I didn't get to work on MonsterCache much over the last week and a half because of Christmas week.  My parents came to visit on the 23rd and stayed until the 30th.  For Christmas, my brother, Matt, got me a Weregoose shirt, I got Kathleen a monster group shot shirt, and Matt got MonsterCache shirts for his kids too.

But one thing I did get done while my parents were here is I got the game loaded on their iPhones!  Once I finally completed my Apple Developer signup, the process of getting the app on the phones wasn't too bad using XCode.  I found 2 issues on iOS though.


  1. Once again, just like Android, I had trouble getting the launch icons working.  My mom had iOS 6.x and my dad iOS 5.x, but I couldn't get the launch icons or splash page to work on either :-(
  2. No sound for catching the monster.  That's something I added recently and definitely not essential, so no real big deal there.
They had a little trouble with registration too, so I'll make some tweaks.  But Mom is off and running, 8 monsters this week, in second place behind Kathleen!

Saturday, December 22, 2012

In-App Billing setback

Just when I thought we were so close... in signing up for Apple Developer and Google Developer accounts, I found that both have restrictions that you must use their markets for purchasing any digital goods in the application.  I failed to anticipate that restriction :-(   My in-app purchasing is not done with their markets.  Actually, it isn't even in-app purchasing technically, because I link out to our web site to do a purchase.  That's also against the terms of both companies.

So.... I need to implement in-app billing for both Apple and Android.  Luckily, very recently an in-app billing Phonegap Plugin was made for just that purpose!  Plugins are separate per OS, so that meant I also needed to split the market page into a version for each OS.  I tried the Android one first, and it worked!  You just use Google's test product IDs, and they come back with fake success messages.  So cool to see the Google Play market open for the first time.

But then.... I discovered that the Plugin seems to be missing a few key features I needed, like the purchaseToken and the API call to consume an in-app purchase.  It looks like I may need to do those parts of the plugin myself.  If I succeed in improving the plugin, of course I would want to share those changes with other PhoneGap users.  That means that I've finally made my way to the GitHub community.  I feel like I'm just barely understanding everything I'm doing, so hopefully I don't make a fool of myself there.  It may be too late as I've already tried to message someone and hopefully didn't send the message to a bunch of people :-/

So much to learn!

Sunday, December 16, 2012

iOS progress

Let's start with the good news.  Last week I built the MonsterCache app on the Mac with PhoneGap and it went quite well!  The only thing that didn't go smoothly was installing the Google Analytics plugin for iOS.  Eventually I remembered that I'd already downloaded it in a .zip file with plugins for different phone OS's.  And eventually, I found the instructions for installing the iOS version of the Analytics plugin.  It was exciting to see the first page in the simulator:


This weekend was the first test to load it on someone's actual iPhone.  That didn't go well.  

The first problem was my Apple Developer account.  I thought that I could load the app onto a phone connected to my computer without doing anything with the Developer account. For that reason, I hadn't even signed up for the Developer account yet.  Once I found out we needed to, I went to sign up and found that the approval process can take 24 hours.  So that killed our hopes for trying it that day.  Incidentally, I signed up yesterday afternoon, a Saturday, and haven't heard anything back as of Sunday night.  So I guess maybe they mean 1 business day for approval???

The second problem was that my friend's iPhone was an older one, a 3GS.  That would have been fine if the OS had been kept up to date, but it was still on 4.0.x.  Turns out the version of the iOS SDK that I'm building with in XCode only supports 4.3 or higher.  We hoped we could upgrade, but its not easy to upgrade to any iOS version that isn't the latest.  The latest is 6.0.x and apparently 3GS iPhone's don't run that very well.  So besides the Developer account issue, the particular phone we had wouldn't have worked anyway.

My parents are coming in to town for Christmas and they have iPhones, so looks like they will be my first iOS beta testers.  In the meantime, I changed the "Forgot Password?" handler to send a password reset link instead of the password itself in clear text. I've been needing to do that for a while, so glad to have that off the list!

Saturday, December 8, 2012

Geocaching: Can't find cache

Today I tried to find a virtual geocache using a different virtual geocaching game that a friend told me about.  Since MonsterCache is also a virtual geocaching game, I figured I better check out some of the competitors.  This one was actually more like a regular geocache than our monsters are because you have to find a physical sticker that someone else placed somewhere.  When you find it you're supposed to scan a bar code on the sticker to show you found it.

I hate to say it, but it reminded me why I found regular geocaching frustrating.  Its a lot of fun when you find the canister -- or whatever is hidden -- and see what's inside.  But its frustrating when you can't find it, and that's what happened today.

I drove near the spot on the map where the phone app indicated this virtual geocache was.  It was just off of a walking trail in the woods.  I parked, got on the trail, went into the woods towards the marker.  As I neared where the marker was indicating, I came to a clearing.  That seemed promising.  But after 10 minutes, at least, of walking around, looking in and under logs, I couldn't find anything.  Hard to imagine that another geocacher moved it.  Maybe some non-geocacher happened across it and took it, but most likely it was just hidden too well for me to find, or the point on the map was off, or the GPS was off.... I don't know.  But the point is, I couldn't find it and felt like I wasted my time.

I got back in my car, and turned on MonsterCache and saw that there was a troll a quarter mile away, so I went and found that right away, which made me happy.  Again, I know it is rewarding to find a hidden physical geocache after you look for it for a while, but I hope that others will agree with me that there's also a big advantage to finding the cache/Monster quickly and moving on to the next one!

Friday, December 7, 2012

Getting Started with Apache Cordova for iOS

There are several "Getting Started" guides for PhoneGap on iOS, which can be very confusing.  One of the most confusing things about it is that there are several on the PhoneGap site alone!!  docs.phonegap.com has an iOS "Getting Started" guide for PhoneGap 2.0, 2.1, and 2.2, and who knows how many others.  When you do different Google searches, any one of those can come up in the results and it isn't immediately obvious which version it is for.  So confusing!

The latest version of PhoneGap at this time is 2.2, so of course I want their Getting Started with iOS for Apache Cordova 2.2 document.  Unfortunately this document is clearly written for people who are comfortable using a Mac, and probably also XCode.  The only reason I own my Mac is to make this iOS version of MonsterCache.  I'm definitely not comfortable on the Mac or in XCode and the guide was not really helping me much.

Thank goodness I found the Getting Started with Apache Cordova 2.2 for iOS document by Becky Gibson.  This is a MUCH better iOS PhoneGap tutorial for many reasons:

  • it actually explains how to do things on the Mac that a Mac novice like myself wouldn't know (like where to find the Terminal app)
  • it has pictures!
  • it has a link to a zip file that has both the regular Cordova files and also the needed CordovaLib, which I could not understand where that came from when reading Cordova's guide
So now I was able to get my first HelloWorld Cordova iOS app built with no errors at all.  I'll try to port over my Android app tomorrow (gulp).  Thanks Becky!

First beta user


Learned a lot from watching our first beta user try the game for the first time. Here is what I observed and the changes that I need to make.

1) He initially tried to log in without registering, as if login form was registration form. So I thought:
a) move registration button above login form (Kent didn't like that idea)
b) login failure message should say, "have you registered?"

2) Then he didn't really read the registration success message and then tried to log in without going to his email., So:
a) Display different login error if their account is still pending
b) Change registration success message to yellow. Its now in green and he said he couldn't read it very well, which is maybe why he didn't really read it.

3) We could get rid of the whole email verification. Not sure I'm ready to do that yet though.

4) He found 3 monsters quickly. He advanced a level, but didn't know it, he didn't see message.. I was thinking maybe the level change message should go above the "yaay, you found one". And the badge could go below that, then monster. Most of time level and badge won't be there, so it will be just monster (Kent didn't like this much either, would like to do 3 separate pages with "There's more..." button.  That is better, so I'll try that)

5) He didn't notice at one point that he'd found the monster and said a sound would be nice.  That was on my future feature list anyway, so I added that. 

Now on to iOS....!




Wednesday, November 28, 2012

Beta done?

I think the beta is done!

  • 4.1.1 bugs fixed (mostly).  
  • Last monster color change made (W.A.A. legs) 
  • Registration tests performed.  
  • Four initial test accounts archived
I made a new account a few days ago, Kathleen made one tonight.  Then she promptly went out and found 8 monsters so she could be the top Legend.  I jokingly got mad at her and said everyone was supposed to be at 0 when we launched beta, and she pointed out that I'd found 2 and I gave myself a head start a few days ago, LOL.

Anyway, too late tonight to send it out, but I plan to send in the morning.


Saturday, November 24, 2012

Google Maps API Circle issue is Android 4.1.1 only

After many hours of making test examples and posting some things online over past 4 days, I've basically confirmed my initial suspicion that the map problem I'm seeing is only an issue on Android 4.1.1.  I assumed that was the most popular version, but now I see that it is only used by 2% of Android users!!

So this maybe isn't *AS* big a deal as I thought, and hopefully they will fix it soon, and it will go away.  I already posted it to a Google Maps issue list:

Now I'm going to try to detect the Android version and do an ugly flashing workaround for 4.1.1 only.  Then we'll be ready for beta with a nice little bonus from upgrading PhoneGap.

Wednesday, November 21, 2012

Back button override fixed in Android PhoneGap!

As a long shot, I updated Cordova/PhoneGap from Cordova 2.0 to Cordova 2.2 to see if it would fix my maps issue. It didn't, as I expected.  But it totally fixed another problem that I'd spent a few hours on! LOL

I've always had trouble with the back button closing the Android app.  You'd think it would just go back to the last HTML page you were on, but that (almost) never happens.  Once every 50 times or so that I hit the back button it goes back a page, and I have no idea why.  Usually it closes the app.  So as a workaround, I wanted to override the back button to give the user a confirm message about closing the app.  The examples posted for how to override back button were pretty simple so I could never understand why it didn't work for me.  I always hoped it would magically start working with a Cordova upgrade, and it has!

Now just have to figure out this dang map issue in order for Beta to be ready....

Beta setback - Android 4.1.1 maps

First post on the MonsterCache blog!  I've been working on the game for about 9 months now.  I've always thought it would be interesting at some point to blog about the process.  I thought that the Beta launch might be a good time to start.  I'll probably gradually fill in more details of the past 9 months as I write more.

As it turns out, we were JUST about to launch the beta when I hit a problem.  I was developing with Android 2.3.  Then I got a new phone a couple weeks ago and started testing with Android 4.x.  I found a minor issue with how I was doing local storage, fixed it, and all was good!  Then....here is the email I sent to Kent and Matt:

I was *SO* close to sending out the beta email last night.  I inactivated my old account, decided to do one last registration test, registered a new account and then I found a big problem.  On the Google Map, its occasionally showing two nets and two circles that are slightly offset, so it looks terrible.  Seems to do it about 1 out of every 4 times the map comes up.  It appears to be only on the new Android, still seems fine on my old phone. Sometimes the nets and maps stay on top of each other, so maybe I jut never noticed it last week, but I actually think it started with an Android update a few days ago.  

Anyway, I need to see if I can fix it, or hope that an Android update comes and fixes it.  Already banged my head against the desk for a couple hours last night but couldn't figure out what in the world is happening.  Could also be PhoneGap, so I'll try updating that next.  But probably won't be resolved until after Thanksgiving. :-(  Sorry.


And here are some screen shots of how the issue looks: