cancel
Showing results for 
Search instead for 
Did you mean: 

Get Battery Percent Pocket

Former Member
0 Kudos

Hi,

Is there a way to get the battery percent of the Pocket with java code? Our customer wants to work with the pocket on Full-Screen and would like to have this information.

Is possible?

Thanks.

Regards,

Bruno

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Bruno,

As far as I know it depends on your vendor, you have to check vendor's SDK as Sivakumar suggested.

Try Batti software to Pocket PC and see if it helps you as an alternative solution:

Batti can run as a topmost indicator, even if full screen applications are running.

Best regards,

Rogério

Former Member
0 Kudos

Hi Sivakumar,

I will do tests about youd said. Thanks again!!

Hi Tamba,

We install Batti Software and it worked very nice. But, the the feature:

Always On: Top Batti can run as a topmost indicator, even if full screen applications are running.

There is a issue:

6 Defect New Medium -


-
Batti uses about 30% of CPU when Always on top setting set up.

But our customer liked about this solution and he will do tests with this application.

Thanks.

Regards,

Bruno

Answers (2)

Answers (2)

Former Member
0 Kudos

I didn´t get to get the battery level yet using CrEmE, but Batti application helped to solve our customer requisition.

Former Member
0 Kudos

Hi Bruno,

Yes its definitely possible. You can use the Intel Mobile Platform SDK and Runtime to achieve this. Kindly refer to [SDK home page|http://ossmpsdk.intel.com/] and you can download the SDK from [here|http://ossmpsdk.intel.com/file.php?fid=26]. The SDK has lots of Java sample codes and some are related to Power and Battery as well. The program will only return you the actual value and you need to decide on the UI technology on how and where to display it. Also this [article|http://softwarecommunity.intel.com/articles/eng/1070.htm] is a good reference that is specific to your case, but the coding is in C++.

Note: I have seen this working on Intel Processor based Pocket PC (Windows Mobile Devices) and hope even your customer also has the Intel processor based devices. I am really not sure if this works on other processors as well.

Hope this helps.

Best Regards

Sivakumar

Former Member
0 Kudos

Hi Sivakumar ,

I did some tests and i saw that it´s necessary the IBM VM (J9).

Our application was developed with SAP Mobile (JSP) and CrEmE VM. Do you have any sugestion to implement our customer requistion?

Thanks,

Regards,

Bruno

Former Member
0 Kudos

Hi Bruno,

IBM J9 is just another JVM for mobile devices. I don't see any issues in using Creme JVM 3.27. Since its a jar file using either of the JVM's wouldn't really matter. Just keep in mind that Creme 3.27 is Personal Java compliant meaning that it is based on JDK 1.1.8 only (So if Intel SDK uses APIs later than 1.1.8 then certain functionality might not work). I am not sure about J9. I suggest you give it a try with Creme JVM.

Best Regards

Sivakumar

Former Member
0 Kudos

Hi Sivakumar,

We followed the steps to test the battery example from Intel (using CrEmE), but occours the error:

java.lang.UnsatisfiedLinkError:

I know that this error is because IntelMobileJNI_CE12.dll is not found, but we put it into Windows folder, but doesn´t work.

Any idea?

Thanks,

Bruno

Former Member
0 Kudos

HI Bruno,

I tried executing this program on the device i have and here are my results.

Inorder to get the battery program working,

1. Copy the following files present under Mobile_Platform_SDK_1.3_for_WinCE\Bin\$Platform\Framework

Layer_Manager.dll

IntelMobile.dll

IntelMobile_Server.dll

Provider_Battery11.dll

IntelMobileErrorInfo.property

providers.xml

If you wish to use other functionality then copy all other Provider dlls as mentioned in the section Framework Core Pre-works in the Quick Start Guide.

2. Copy IntelMobile12.jar to root folder and IntelMobileJNI_CE12.dll to Windows folder from Mobile_Platform_SDK_1.3_for_WinCE\Bin\$Platform\Binding\Java

3. Exectue buildSamples.bat present under Mobile_Platform_SDK_1.3_for_WinCE\Samples\$Platform\Java\Samples_CE and copy the generated JavaSamples_CE.jar file to the root folder

4. Use the following entry in the runBatterySample.lnk file

255#"\Windows\CrEme\bin\CrEme.exe" -bcp 'JavaSamples_CE.jar;IntelMobile12.jar' -Of battery.BatterySample

5. Execute the runBatterySample.lnk file.

But having done all this, as mentioned in my previous post, my worst fear has come true. Seems that Intel SDK is using APIs higher than 1.1.8 and therefore CrEme 3.27 doesn't support this functionality. I didn't get the UnsatisfiedLinkError but the following exception.

NSIcom Ltd., CrEme(tm) 
CrEme J2ME(tm)
CrEme V3.27a B102.020706 02-Jul-2006
  MemoryLimit=27712Kb
EBCI(TM) Interpreter V1.00,
Copyright 1998-2002 by Bytecodes, Inc.
java.lang.IncompatibleClassChangeError: class java.util.Hashtable does not implement interface java.util.Map
	at com.intel.mobile.base.BaseEnum.<init>()
	at com.intel.mobile.battery.ConditionEnum.<init>()
	at 
	at com.intel.mobile.battery.ConditionEnumProperty.GetValue()
	at battery.BatterySample.printInfo()
	at battery.BatterySample.main()

Now i tried using CrEme 4.12 that is used by Mobile 7.1 and this version of CrEme is JDK 1.3 compliant and by using this i was able to execute the program successfully and here is my output

NSIcom Ltd., CrEme(tm) 
CrE-ME J2ME(tm)
CrE-ME V4.12 B142.190307 19-March-2007
  MemoryLimit=27712Kb
EBCI(TM) Interpreter V1.00,
Copyright 1998-2002 by Bytecodes, Inc.
------------ Output Battery Info ------------
Type: Battery
Key: mainbattery

Condition: Charging
Chemistry: BATTERY_CHEMISTRY_LION
PercentRemaining: 73 %
Rechargeable: true
Id: mainbattery
Voltage: 4060 mV
------------ Output Battery Info ------------
------------ Output Battery Info ------------
Type: Battery
Key: backupbattery

Condition: Charged
PercentRemaining: 100 %
Rechargeable: true
Id: backupbattery
Voltage: 3196 mV
------------ Output Battery Info ------------

Conclusion: Unfortunately you cannot use this SDK with CrEme 3.27

Best Regards

Sivakumar

Former Member
0 Kudos

Hi Sivakumar,

Thanks again for your help.

I did what you said (install CrEmE 4.12 and the others steps), but the error java.lang.UnsatisfiedLinkError: no IntelMobileJNI_CE12 in java.library.path continues.

I´m without a device here, so i´m using a Windows Mobile 5.0 Emulator. Maybe that is the problem? What do you think?

Regards,

Bruno

Former Member
0 Kudos

HI Bruno,

I really do not trust device emulators since i have come up with such errors even while they work perfectly on the actual device. Your case could also be the same.

Best Regards

Sivakumar