Namespaces

Variants
Actions

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.

Managing Platform Services 2.0 permissions prompts

From Wiki
Jump to: navigation, search

This article explains how to manage permission prompts, when using Platform Services 2.0 APIs

Article Metadata
Tested with
Devices(s): Nokia C7-00
Compatibility
Platform(s): WRT 7.3
Device(s): WRT 7.3 (Browser 7.3) onwards
Article
Keywords: getServicePermissions
Created: isalento (28 Feb 2012)
Last edited: hamishwillee (05 Jul 2012)

Summary

Security prompts are necessary to keep end user on control of what the Widget can do or not. However, if widget uses many Platform Services (PS) APIs, user experience degrades, as user has to grant permission for each API separately. Platform Services 1.0 offers an API to group these requests into one prompt: device.getServicePermissions(serviceSignatureObject);


When using Platform Services 2.0, it is not always clear what APIs you need to request access to, in order to make your widget to work without additional permission queries. One PS 2.0 API can use multiple PS1.0 APIs under the hood, to provide more complete interface to developer. One undocumented service provider, that PS 2.0 uses internally, is ServiceRegistry. You don’t have to worry about details of this API, other than its signature. Signature consists of service provide name and interface name.

"Service.ServiceRegistry":"IService"

This signature needs always to be included in service signature object, which is passed to getServicePermissions() method. Rest of the service signatures depends on what PS 2.0 APIs are used. Those can be found, by looking at platformservices.js file . For example PS 2.0 Camera API uses System information API, for getting camera properties and MediaManagement API to fetch captured image. Then we need access to following providers:

//check that device & getServicePermissions exist for backward comptibility	
if(device && typeof device.getServicePermissions == "function"){
try {
device.getServicePermissions({
"Service.ServiceRegistry":"IService",
"Service.SysInfo":"ISysInfo",
"Service.MediaManagement": "IDataSource"
});
}
catch (e) {
//notify the user that access to services has been declined
alert("declined");
return;
}
}
//continue by using old per service permission model


Following list has the signatures needed in addition to "Service.ServiceRegistry":"IService" to make PS 2.0 API to work, without additional prompts.

  • Camera API:
    • "Service.SysInfo":"ISysInfo"
    • "Service.MediaManagement": "IDataSource"
  • Calendar API :
    • "Service.Calendar”: "IDataSource"
  • Communications Log API:
    • 'Service.Logging',:'IDataSource'
  • Contacts API:
    • "Service.Contact": "IDataSource"
  • Landmarks API:
    • "Service.Landmarks": "IDataSource"
  • Location API:
    • "Service.Location": "ILocation"
  • Media Management API:
    • "Service.MediaManagement": "IDataSource"
  • Messaging API:
    • "Service.Messaging": "IMessaging"
  • Sensors API:
    • 'Service.Sensor': 'ISensor'
  • System Information API
    • 'Service.SysInfo': 'ISysInfo'
This page was last modified on 5 July 2012, at 02:41.
51 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.

×