Get access to over 100 FireMonkey cross platform samples for Android, IOS, OSX, Windows, and Linux!

AndroidAppmethodCode SnippetDelphiFiremonkey

Retrieve The Battery Level On Android Using Delphi Firemonkey

Battery Level Android Delphi FiremonkeyIt turns out that reading the battery level is quite straight forward Android SDK work and not so straight forward Delphi work. On the Te Waka o Pascal blog, the author describes just how straight forward and not so straightforward it can be, and even provides the code and investigation techniques he used to do it. A few things the author mentions are that…

  • Embarcadero seems to have gone out of their way to make it hard to find some of the various bits of the JNI that they have provided.
  • That there are some pieces missing from the supposedly comprehensive JNI wrappers.
  • Delphi provides none of the syntactic sugar that makes working with the Java SDK more Pascal-like.
  • The JNI wrappers use a combination of classes and interfaces. Since interfaces do not have constructors, this makes constructing instances of a class an operation which cannot simply be taken directly from any Java code you might find.

Visit the Te Waka o Pascal blog to learn how to retrieve the battery level on Android using Delphi

close

Have Delphi Firemonkey questions? Ask and get answers on StackOverflow.

Related posts
AndroidC++BuilderDelphiFiremonkeyIOSOSXWindows

FireMonkey 10.4.2 Features Updated iOS 14, Android 11, And macOS 11 Support Plus Hundreds Of Fixes

DelphiIDEShowcaseWindows

Ryzen 9 5950x: One Billion Lines Of Delphi Code Compiled In ~5 Minutes On 16 Cores

DelphiFiremonkeyIDEIOSOSXWindows

DelphiCon 2020 FireMonkey Sessions Available Starting November 19

AndroidC++BuilderDelphiDemoFiremonkeyWindows

Powerful Commercial Gorilla3D Framework Upgraded For Delphi FireMonkey On Windows And Android

Sign up for our Newsletter and
stay informed

Leave a Reply