{"id":642,"date":"2012-11-26T10:51:58","date_gmt":"2012-11-26T09:51:58","guid":{"rendered":"http:\/\/www.owlfish.com\/weblog\/?p=642"},"modified":"2012-11-30T00:25:40","modified_gmt":"2012-11-29T23:25:40","slug":"android-device-compatibility","status":"publish","type":"post","link":"https:\/\/www.owlfish.com\/weblog\/2012\/11\/android-device-compatibility\/","title":{"rendered":"Android device compatibility"},"content":{"rendered":"<p>It took me two days of digging around to finally figure out why ExpenseClam was not working properly on the HTC One X. The symptoms were straightforward enough: taking a picture would show a blank result, and the expense record showed a warning icon saying that the image file could not be loaded.<\/p>\n<p>By adding some debug cpde, and with the help of a friend who owns the device, I was able to confirm that the camera code was creating an image file and that it was successfully saved. By signing up to testdroid.com I could get access to the logcat output of a real device on the cloud, which gave me the next breakthrough. My call to BitmapFactory.decodeFile was failing to return a bitmap, in turn caused by SkImageDecoder returning null.<\/p>\n<p>Searching online sent me chasing a few red herrings, but eventually I had the idea of removing the code which sets the thumbnail size before taking the photo. Suddenly it worked, the bitmap correctly loads. So what went wrong?<\/p>\n<p>The API documentation for setJpegThumbnailSize is fairly unambiguous &#8220;If applications set both width and height to 0, EXIF will not contain thumbnail.&#8221; Further to this the method getSupportedJpegThumbnailSizes states &#8220;This method will always return a list with at least two elements. Size 0,0 (no thumbnail) is always supported.&#8221; Based on this I had chosen to disable thumbnails in order to reduce image file sizes.<\/p>\n<p>It turns out that only most devices support this. The HTC One X accepts setting the thumbnail size to 0, but then produces a file that the BitmapFactory cannot read. Leaving the thumbnail settings to the device defaults works.<\/p>\n<p>Hopefully this post will save someone else a couple of days investigation.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It took me two days of digging around to finally figure out why ExpenseClam was not working properly on the HTC One X. The symptoms were straightforward enough: taking a picture would show a blank result, and the expense record showed a warning icon saying that the image file could not be loaded. By adding [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/www.owlfish.com\/weblog\/wp-json\/wp\/v2\/posts\/642"}],"collection":[{"href":"https:\/\/www.owlfish.com\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.owlfish.com\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.owlfish.com\/weblog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.owlfish.com\/weblog\/wp-json\/wp\/v2\/comments?post=642"}],"version-history":[{"count":1,"href":"https:\/\/www.owlfish.com\/weblog\/wp-json\/wp\/v2\/posts\/642\/revisions"}],"predecessor-version":[{"id":643,"href":"https:\/\/www.owlfish.com\/weblog\/wp-json\/wp\/v2\/posts\/642\/revisions\/643"}],"wp:attachment":[{"href":"https:\/\/www.owlfish.com\/weblog\/wp-json\/wp\/v2\/media?parent=642"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.owlfish.com\/weblog\/wp-json\/wp\/v2\/categories?post=642"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.owlfish.com\/weblog\/wp-json\/wp\/v2\/tags?post=642"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}