Please note that as of October 24, 2014, the Nokia Developer Wiki will no longer be accepting user contributions, including new entries, edits and comments, as we begin transitioning to our new home, in the Windows Phone Development Wiki. We plan to move over the majority of the existing entries over the next few weeks. Thanks for all your past and future contributions.

Revision as of 06:47, 19 November 2013 by hamishwillee (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)


From Wiki
Jump to: navigation, search
WP Metro Icon Chinese.png
Article Metadata

Series 40

Amazing1100 在 29 Jun 2012 创建
最后由 hamishwillee 在 19 Nov 2013 编辑


你可以使用Nokia UI API 来控制屏保,一次达到保持屏幕常亮的需求,我们知道屏保一般在设定的时间内,如何没有任用户何动作作用于设备的话,屏保会自动开启,你可以通过保持屏幕背光灯激活的方式来阻止屏保,以达到常亮的目的。


Nokia UI API中提供了两个方法来控制背光灯:

  • DeviceControl.setLights
  • DeviceControl.resetUserInactivityTime

如果手机支持Nokia UI API 1.4或者更新版本,那么建议在Symbian设备上使用DeviceControl.resetUserInactivityTime,在Series40上使用DeviceControl.setLights。, 还可以用来控制设备的其他一些属性,比如震动,闪光灯等。


- DeviceControl.setLights

public static void setLights(int num, int level)

num - 标识当前你要设置的灯光的ID,0表示背光灯,目前还没有其他的可以值,也就是说目前仅仅支持背光灯的设置。 level - 亮度水平值,0-100

DeviceControl.setLights 方法用来激活以及关闭屏幕背光灯,当使用它来激活背光,该方法对点亮背光,同时重置屏保计时器。如果在一个循序中,以小于屏保计时器的时间间隔来调用此方法,那么我们可以使用屏幕常亮了。

下面的例子演示了如何使用 DeviceControl.setLights 方法来阻止屏保,以使屏幕常亮, 但是我们不能够通过API来获取屏保timeout的时间值,所以我们在例子中使用特定值。

class DisableScreenSaver extends Thread {
public void run() {
while(true) {
DeviceControl.setLights(0, 100);
try {
Thread.sleep(4000); // minimum screen saver timeout in UI is 5 seconds
} catch (InterruptedException e) {
public class MyMidlet extends MIDlet {
public void startApp() {
new DisableScreenSaver().start();
This page was last modified on 19 November 2013, at 06:47.
116 page views in the last 30 days.

Was this page helpful?

Your feedback about this content is important. Let us know what you think.


Thank you!

We appreciate your feedback.