Lazarus

Programming => Operating Systems => Android => Topic started by: benohb on August 01, 2020, 03:25:06 am

Title: LAMW and BATTERY STATS
Post by: benohb on August 01, 2020, 03:25:06 am
Is there a way to know the voltage and amps



Title: Re: LAMW and BATTERY STATS
Post by: jmpessoa on August 01, 2020, 04:39:36 am
Hello, benohb!

Can you point up some java/android code example?

[If yes, I can try implement a LAMW pascal code wrapper ....]
Title: Re: LAMW and BATTERY STATS
Post by: benohb on August 01, 2020, 11:47:20 am

https://www.programcreek.com/java-api-examples/?class=android.content.Intent&method=ACTION_BATTERY_CHANGED




Title: Re: LAMW and BATTERY STATS
Post by: benohb on August 01, 2020, 04:38:04 pm

Oh yes
BatteryManager Just a struct
https://android.googlesource.com/platform/frameworks/base/+/2164cf4f4043b4892db5688ed53624af758fcdaa/core/java/android/os/BatteryManager.java

so ...

Code: Pascal  [Select][+][-]
  1. jBroadcastReceiver1.IntentActionFilter:= afBatteryChanged;

and
Code: Pascal  [Select][+][-]
  1. procedure TAndroidModule1.jBroadcastReceiver1Receiver(Sender: TObject; intent: jObject);
  2. begin
  3.  
  4.  
  5.    ShowMessage('Broadc: ' + inttostr(jIntentManager1.GetExtraInt(intent,'voltage')));
  6. end;      
  7.  
Work

@jmpessoa
I am in developer mode. Will I need some type of permissions after release َAPK ??
Title: Re: LAMW and BATTERY STATS
Post by: jmpessoa on August 03, 2020, 01:59:04 am

From LAMW/docs:

https://github.com/jmpessoa/lazandroidmodulewizard/blob/master/docs/How_To_Get_Your_Signed_Release_Apk.txt
Title: Re: LAMW and BATTERY STATS
Post by: benohb on August 05, 2020, 01:15:09 am


Thank you jmpessoa  :D

Also, my thanks to you about JmyHello (The empty component) It helped me a lot with making a new battery component
Title: Re: LAMW and BATTERY STATS
Post by: jmpessoa on August 05, 2020, 03:12:49 am
Quote
It helped me a lot with making a new battery component..

Can you publish it?

Hint:
https://github.com/jmpessoa/lazandroidmodulewizard/blob/master/docs/how_to_create_new_components.txt
Title: Re: LAMW and BATTERY STATS
Post by: benohb on August 09, 2020, 02:00:26 am
jmpessoa

battery component…

It has dependencies with

Code: Pascal  [Select][+][-]
  1. jBatteryManager = class(jControl)
  2.  private
  3.     FOnReceiver: TOnReceiver;
  4.     Broadcast:jBroadcastReceiver;
  5.     jIntentManager1:jIntentManager;  

The problem is that Lazarus puts them above the window automatically (jBroadcastReceiver and jIntentManager)
I need them because the battery class element is not available in API <21
TinyPortal © 2005-2018