Devicecontrol class for Nokia's j2_extended API--UI APIs

Source: Internet
Author: User

Devicecontrol class for Nokia's j2_extended API--UI APIs

Author: Chen yuefeng

From: http://blog.csdn.net/mailbomb

Note: Please note the source name when reprinting and keep the article complete

 

Nokia Expands a feature on all Nokia mobile phones based on the standard j2's API. These features are provided to developers in the form of extended APIs, these extended APIs are the famous Nokia UI APIs.

For Nokia ui api documentation, you can find it in the docs directory of any simulator in/devices under the Nokia developer's suit installation directory.

The devicecontrol class is a class that controls the flickering background light of a mobile phone and the vibration of a mobile phone. It belongs to the com. Nokia. Mid. UI package and needs to be introduced before use. The main methods include:

1. flashlights

The method declaration for this method is as follows:

Public static void flashlights (long duration)

The function of this method is to temporarily flash the duration parameter specified by the screen background light in milliseconds.

After this method is called, the thread execution will not be blocked. If the device does not support this method, the method will automatically return. If the set time exceeds the maximum time supported by the device, the system automatically returns the value after the maximum blinking time.

When this method is returned, it is automatically returned to the status before flashing.

To end the execution of this method, you can use flashlights (0.

Parameters:

Duration: the number of milliseconds that flash. If the number is smaller than 0, illegalargumentexception is thrown.

Example:

Devicecontrol. Flashlights (3000 );

The purpose of this Code is to set the background light to flash for 3 seconds.

2. setlights

The statement of this method is as follows:

Public static void setlights (INT num, int level)

This method is used to set the brightness of the screen background light.

Parameters:

Num -- 0 indicates that the background light is displayed. Other parameters are retained temporarily.

Level-brightness level, a number between 0 and 100. 0 indicates that the brightness is disabled, and indicates the maximum brightness.

Example:

Devicecontrol. setlights (0, 60 );

This Code sets the brightness of the background light to 60.

3. startvibra

The statement of this method is as follows:

Public static void startvibra (INT freq, long duration)

This method is used to make the mobile phone vibrate.

This method does not block program execution. After calling this method, the program will automatically return.

Parameters:

Freq: the vibration frequency. A value ranging from 1 to 100 indicates the maximum vibration frequency.

Duration-the duration of the vibration, measured in seconds.

Example:

Devicecontrol. startvibra (50,1000 );

The function of this Code is to make the mobile phone vibrate for 1 second at a frequency of 50.

4. stopvibra

The statement of this method is as follows:

Public static void stopvibra ()

The function of this method is to stop the vibration of the mobile phone. If the mobile phone is not in the shaking status, the method returns quietly.

Example:

Devicecontrol. stopvibra ();

 

In fact, other manufacturers' API extensions also implement similar functions, but their expressions are different.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.