Keep On Running… Some may have noticed that I updated my previous post with a footnote describing an issue with my battery widget not resuming it’s updates after the phone went into (and came out of) deep sleep. I got to the bottom of that and can now happily report that my widget seems 100% reliable and the solution is not contributing to any additional battery drain. This is what I did…
Well Behaved Widgetry When we left it, my battery widget was working but wasn’t particularly well behaved. There was nothing much wrong with the functionality, but plenty wrong with the implementation.
In a previous post I noted the absence of the BatteryManager class in the AndroidAPI.JNI units. This class contains some constants useful when reading battery information. I showed how to use a suitably massaged literal in place of these missing constants, but in response to observations from Paul and Brian decided to look at how to import the missing class itself.
The short answer is: Yes, init() In a previous post I lamented the fact [cough – Ed] that some Java class imports appeared to support the underlying Java constructors via an init() method, where others did not. This wasn’t a “fact” at all. It was a misunderstanding based on an incomplete grasp of the machinations of the Java class import mechanism in the AndroidAPI units.
Over the past few days I posted a two part series showing how to obtain the current battery level as part of the implementation of an Android AppWidget using Oxygene. As far as I can tell AppWidgets simply aren’t possible using Delphi but reading the battery is quite straightforward Android SDK work, and I thought a comparison of the Oxygene and Delphi equivalents might be interesting.
In the first instalment of this series, I implemented the basic framework of a new appwidget and established a means by which I could debug the widget code. Now it’s time to add some code worth debugging.
With my external HDD trials and tribulations behind me, I have finally been able to complete a project I started last weekend – implementing an Android AppWidget. Along the way I have learned some more about both Android and Oxygene and what can be involved with working with the two together.
This is it. The home straight. The final part of my series on writing a camera app using Oxygene for Android. In this concluding part I shall look at making my application a well behaved Android citizen. As well as pointing out (and fixing) some mistakes I have made along the way, we will add a new capability.
Lachlan just posted a link to a post on Google+ (also available as a PDF) demonstrating how to call Java from Delphi XE5.
The fourth and final part in the not-as-short-as-I-thought-it-would be series on building a camera app for Android using Oxygene. In this penultimate instalment we will add the capability to actually take a picture. But that won’t take very long, so then we will spend a bit of time tidying up the application UI.