tags:

views:

228

answers:

2

I'm involved in yet another application . this time, it's about developing a J2ME application.

the mobile the application will run on is going to be connected to an electrical socket .

and whenever the mobile is unplugged (interruption of electrical energy supply in the battery), the application should detect it and do some custom actions such as send an sms or something else.

so, i want to know what piece of code can I use to detect energy supply interuption in a J2ME app ?

+1  A: 

This would have the same answer as your other question on the subject:

The only standard way of doing this is through JSR-256 (either that or it can't be done). You can read the specifications from http://www.jcp.org/en/jsr/detail?id=256

Unfortunately it is very recent and not actually implemented in most retail phones yet.

When it ships, the Sony Ericsson Satio (or Idou) will have it.


Edit: Since it's now asked in the comments to this reply, the Symbian OS C++ API to check battery status is:

CTelephony::TBatteryInfo

Look it up in the Developer Library documentation at:

http://developer.symbian.com/main/documentation/sdl/symbian94/index.jsp


Edit: best guess at JSR-256 example code is at http://stackoverflow.com/questions/950172/jsr-256-battery-events/951223#951223


Edit: Nokia N97 has JSR-256 and it can be installed on Nokia N85 and Nokia 5800.

QuickRecipesOnSymbianOS
thanks. is that functionality available using native development in mobile phones ? (targeting Symbian OS directly).
Attilah
Hi QuickRecipes !how do I achieve the same thing with JSR-256 ?
Attilah
A: 

If its Symbian OS you can use a tsr(spelling?) on the Symbian side and communicate with using jni on the j2me side.

Fred Grott
Creating JNI extensions is not available to third party developers on Symbian OS. The phone manufacturer needs to do it for you.
QuickRecipesOnSymbianOS
that blows goats..
Fred Grott
In order to support a proper J2ME security model and access a lot of Symbian OS APIs, the Symbian J2ME implementation needs to be a high capability process as far as the Symbian security model is concerned. It would be too dangerous to give any third party developer the ability to extend it.
QuickRecipesOnSymbianOS