Question

For example, i have a java based old phone and i want to write an application to control it's flashlight diode. Is there any universal way to do it via j2me?
Something like:

EnableFlashlight();

that should work for every java based phone.

Was it helpful?

Solution

If your phone supports widely spread MIDP 2 (JSR 118) then you can use Display.flashBacklight API:

Requests a flashing effect for the device's backlight. The flashing effect is intended to be used to attract the user's attention or as a special effect for games. Examples of flashing are cycling the backlight on and off or from dim to bright repeatedly. The return value indicates if the flashing of the backlight can be controlled by the application.

The flashing effect occurs for the requested duration, or it is switched off if the requested duration is zero. This method returns immediately; that is, it must not block the caller while the flashing effect is running.

Calls to this method are honored only if the Display is in the foreground. This method MUST perform no action and return false if the Display is in the background.

The device MAY limit or override the duration. For devices that do not include a controllable backlight, calls to this method return false....

Generally, the answer to your question is no - eg very old MIDP 1.0 (JSR 37) Java phones do not support such a functionality.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top