Recent

Author Topic: LAMW and BATTERY STATS  (Read 2174 times)

benohb

  • Full Member
  • ***
  • Posts: 213
LAMW and BATTERY STATS
« on: August 01, 2020, 03:25:06 am »
Is there a way to know the voltage and amps




jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: LAMW and BATTERY STATS
« Reply #1 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 ....]
« Last Edit: August 01, 2020, 04:41:17 am by jmpessoa »
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard


benohb

  • Full Member
  • ***
  • Posts: 213
Re: LAMW and BATTERY STATS
« Reply #3 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 ??

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

benohb

  • Full Member
  • ***
  • Posts: 213
Re: LAMW and BATTERY STATS
« Reply #5 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

jmpessoa

  • Hero Member
  • *****
  • Posts: 2297
Re: LAMW and BATTERY STATS
« Reply #6 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
Lamw: Lazarus Android Module Wizard
https://github.com/jmpessoa/lazandroidmodulewizard

benohb

  • Full Member
  • ***
  • Posts: 213
Re: LAMW and BATTERY STATS
« Reply #7 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
« Last Edit: August 09, 2020, 02:02:19 am by benohb »

 

TinyPortal © 2005-2018