Tuesday, October 25, 2011

Fun with Android DatePicker and 1970

I was doing a new round of testing on our Android tablet. The application is used for medical information entry and one of the fields is date of birth. It has been working like a champ on the phones using 2.01, 2.2, 2.3 but on the tablet running 4.1 you could not enter anything before 1970. You could type in 1963 and it would set it back to 1970 and the [-] button would disappear.

I totally get why it stops at 1970 as that is the epoch year used for all sorts of things in computers. Obviously the Android team changed a default in later versions of the SDK. My phone, running 2.2, allows you to go back to 1900.

After some research I found a solution that works for all devices I have tested against. In my XML file I added android:startYear="1900" to my definition. If you look in the latest documentation they discuss android:minDate but that is only available in later version of the SDK.

Before I stumbled upon startYear I tried to use reflection to call the setMinDate(long) on the datepicker but I did not have any luck doing that. I am really happy that was not the solution. I would much rather use something in the XML that solves it on all platforms.

Of course after I did this SVN got confused about a directory already being locked and would not allow me to check in the change. I found Team -> Cleanup in Eclipse solved that issue.

Now that I have my new "set favorites" processing in place on the Android I need to convert all that work over to the iPhone / iPad. Research time as some of it just does not have a direct translation to iOS and while the menu system is possible on the iPad it is officially not supported on the iPhone so I am going to have to come up with a work around. The first menu system I found has caused apps to be rejected by Apple due to private method usage making it a non-option. Dual iOS / Android development has a lot of headaches.

Wednesday, October 19, 2011

ADT 14 breaks Eclipse 3.7 - FIXED

Just to make sure my week goes as smoothly as possible I installed ADT 14 / SDK 14 for the new Android 4.0 build and now I can't build anything on my Win7 64bit box.

First I installed the new SDK. Then I installed the new ADT after I got some errors. Now I just get an error that my project has errors but not a single window will tell me what the error happens to be. I installed the SDK from scratch and still have the same error. I installed a fresh version of  Eclipse 3.7, ADT 14 and SVN plug-ins and still have the same issue. I have run every update possible. Our bandwidth sucks right now so this is taking a really long time and I am getting really tired of experimenting. I will have to give this a try at home to see what happens there tonight.

I did cleans before I did builds and did the Android -> Fix Project menu item but nothing will get me past the error message that I have a project error but nothing will tell me what the error is. Not a single file, other than the main project, is marked as in error. I see others are having the same issue on the web. I looked in the project properties and nothing is showing up as in error there either.

At this point I am running Eclipse on my Mac as it has not been updated to 14. No idea what to do next. I just got out of the iTunes / Xcode / iOS 5.0 install hell. At least that is all working. Now I get to be really annoyed at Google / Android from screwing this up. Guess I can blow away all the version 14 stuff and go back to 13 to see what happens. Seems this is all a bit rushed.

Well not the fault of Eclipse or Google on this one. My developer certificate happened to expire at the exact same time I installed the update. Once I deleted the old certificate off my HD an let Eclipse build a new one all was fine. Somewhere in there showing errors in the Problem tab had gotten turned off - it was only showing warnings thus it looked like nothing was wrong. What a huge waste of time and energy it took to figure all of this out. I wish the error message would show your the current error list instead of just saying "there is an error, good luck finding it!"

Friday, October 14, 2011

Pains of iOS 5.0 from a developer perceptive

We needed to test our app under iOS 5.0 so I began that process yesterday.

Step 1: Download and install new iTunes
Success - no issues

Step 2: Connect iTouch Rev 4, install iOS 5.0
Success - but blew away everything on device. I only use it to test, not a big deal.

Step 3: Install and run app on iTouch
Failure - Xcode does not know about iOS 5.0 devices so it refused to install. I find this to be stupid as the target of device of the code is 3.0.

Step 4: Download and install Xcode 4.2 for Snow Leopard
Success / Failure - Takes a long time to get it but it installed. Install works but it blows away all SDK version prior to 4.0. I can't test with a 3.2 simulator at this point. Xcode 4.2 has some new warnings that are valid. I fix those issues in the code while I am fixing the iOS 5.0 issue.

Step 5: Install app on iTouch
Success - it now will install

Step 6: Test app on iTouch
Failure - it crashes because some really old code is using NSIndexPath passed to didSelectRowAtIndex path call later. I need to copy and retain the data to solve the issue. Never a good programming idea in Objective C to think any variable passed to you will hang around. No other version of iOS cared about this particular one. Could be they fixed some things to get ready for dual core processing or other threading issues.

Step 7: Check in changes
Failure - Xcode "sees" SVN for a brief second then gets lost. Use IntelliJ AppCode to check in changes. Find out I need put the URL to our instance of SVN into Safari. Safari bitches about certificate but I can tell it to stop bitching then Xcode starts to work. Xcode SVN interaction has always been spotty at best and again it bites me in the behind.

Step 8: Archive for app submission
Failure - Xcode can't find my deployment provisioning profile. Delete profiles, refresh, rebuild,  restart Xcode, pray, etc. Something finally works and I can set the deployment area to the proper profile. Archive menu item is disabled. Search Google and remember that you must select iOS Device as target for this to be enabled. Remember how stupid that is from the last time this happened to me so many months ago.

Step 9: Validate
Failure - Message tells me it can't find the app in iConnect. Google the message and see that I have to have the app in "waiting to upload" state before it will validate it. Next step will be for the boss to do that so I can try again.

Step 10: Test on iTouch without iOS 5.0
Failure - By default Apple has decided that anyone not running on a armv7 device should just throw the worthless piece of crap in the trash and give them more money. Connect device, press RUN and all you get is a message that it finished running on the device even though it did not install or run. No error, no console, no help - thanks Apple. You have to open up the build settings and add armv6 back into the supported architectures then it will run on the device just fine. If you only test with the simulators you would not find this issue as the simulator is i386 architecture and I was able to run all the way back to 4.0 using that. After installing Xcode 4.2 you would be hosed unless you tested on physical devices.

Step 11: Submit to store
Success - Once the boss got the app in "ready to submit" mode I was able to validate and submit it without any issues. The error message was stupid. We also put up new screen shots for both the iPhone and iPad.

Step 12: Released to market
Success - It only took Apple two days. I was expecting 10. Kudos to Apple for cranking this one out. Last time it took 7 days and I figured they would be swamped. We did put in the notes that it was an iOS 5.0 fix being released. Between that and small download count I am sure they just pushed it through figuring if we screwed the pooch on this one it would come back to haunt our users and us but not really Apple.

A huge waste of time this has been. What you need to do is not obvious. The new updates from Apple are not friendly and blow away or break things. Apple is rather developer hostile. I need to get the app submitted to the market as it is broken under iOS (our fault, not Apples fault). With a rash of people submitting to Apple right now for iOS 5.0 who knows how long I will be in the queue. All our current users who upgrade will be hosed. This is a huge failing of the Apple Store. I will not be able to get a couple of line fix out to our customers in a timely manner.

Xcode continues to be a very annoying IDE. If this is what Apple considers a good UI and user friendly then I don't want to know what they are like when they are mad at me.

Thursday, October 6, 2011

Released Android Version

We put the new Android version on the market yesterday. Should have been a really simple process and it started out to be so but one little piece screwed us over for a bit. I did the export in Eclipse and after we typed in the two passwords we have the APK file ready to roll. Logged into the publish side of the Market and uploaded the APK then went to change to screen shots and what not. Things did not work. I kept getting an error and was told to try again later. Later never seemed to be late enough.

I read that Chrome was having issues with the new market. Go figure, the browser from the company that owns the Market does not work. We tried I.E. figuring it had to work but it had the same issue. FireFox worked without a hitch. What the hell are they doing that only works in FireFox? Very annoying but it has been submitted and our various devices were notified there was an update so we know it is out there and working.

Our Beta test Doctor now has access. We have to flip on a bit on our server for them to be able to see the new functionality so everyone else will see some minor color scheme and little tweaks but they will not have access to the new functionality until we are ready to turn it on.

Of course I found an issue already. Not a crash but one of the tables was not loading all the data it needed as I only asked for Type 1 data and I needed Type 1 and Type 3 data in the table. Pretty simple fix and there is a good chance the Doctor will not need this. I can easily release an update if he does need it for this testing.

I also did some UI tweaks while I was in there. Some buttons needed to be larger to give them a better look and to make them an easier tap target. I took the iPad home last weekend to give it a solid once over but I have not taken the ASUS Android Tablet home yet to run it as a user out the the interruption driven office setting. I did have a little time to play with it today so I of course found things to adjust.

Next up is getting the iOS side ready to submit. I had to make the same table request changes on that side along with a few other tweaks. I got a note from Apple telling me I can get the Gold Master of the SDK and the updated Xcode. I really don't want to do that as it is a 4.6g download then I will just have to get the real release in a little over a week. If it was a patch that would be one thing but it is an overnight download so I am not going to do it multiple times. I have fallen in that trap once before.

The problem is I did the archive and tried to validate but it is annoyed in some manner. So I have to figure that out. Could be I changed the name of something and it does not think I am updating and existing application.

I decided to check out what changed in iOS 5 that may affect our app. I log in to the Apple Developer Network and it does not think I am a developer so it will not let me see anything. I ask my boss to check out the corporate account, which Apple has screwed up many a time, and it needed him to agree to a new terms of use. After that I was able to see the iOS 5 information on the site but I still can not validate out app.

From what I can tell we might be affected by some iOS 5 changes. It reads that way at first glance but until I am able to run iOS 5 in the simulator or upgrade one of our devices - probably the iPad 2 - I will not know for sure.

The sales guy stopped by to have the latest version put on his iPhone for a demo tomorrow. Luckily his phone has already been provisioned so that was easy. I also put the latest version in the iPad 2 and gave that to him as it is much easier to demo on a tablet. Will be interesting to hear what the clients have to say about the application.