[permissions] ACTION-436: Provide an example for Permissions

Sorry. This is TAG version ;)

 

Here is an example for Feature Permissions.

If you have any comment, its more than welcome ;)

 

 

var featureID = "contacts";

 

function doSomeThing() {

// Getting the permission level of a feature

var response = navigator.permissionLevel(featureID);

 

  if (response === 2) {   //  USER_ALLOWED = 2

// Do something with USER_ALLOWED permission

     getContacts(); // Perform an contacts search

     ...

  }

else

// Do something with USER_DENIED permission

alert("This web app will be working except your "+featureID+" information");

}

 

navigator.requestPermission(featureID, doSomeThing);

 

 

Best regards,

Wonsuk.

========================================= 

   (Wonsuk, Lee) / Senior Engineer, Ph.D

SAMSUNG ELECTRONICS Co., LTD. (߲)

Mobile: +82-10-5800-3997

E-mail: wonsuk11.lee@samsung.com

http://www.wonsuk73.com/, twitter: @wonsuk73

-----------------------------------------

Inspire the World, Create the Future !!!

=========================================

 

========================================= 

   (Wonsuk, Lee) / Senior Engineer, Ph.D

SAMSUNG ELECTRONICS Co., LTD. (߲)

Mobile: +82-10-5800-3997

E-mail:  <mailto:wonsuk11.lee@samsung.com> wonsuk11.lee@samsung.com

 <http://www.wonsuk73.com/> http://www.wonsuk73.com/, twitter: @wonsuk73

-----------------------------------------

Inspire the World, Create the Future !!!

=========================================

 

Received on Tuesday, 23 August 2011 06:22:25 UTC