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.

Revision as of 00:03, 8 May 2013 by hamishwillee (Talk | contribs)

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

Recuperando o IMEI utilizando WRT

From Wiki
Jump to: navigation, search
Article Metadata

Testado com
Aparelho(s): Nokia 5800 XpressMusic

Compatibilidade
Plataforma(s): S60 5th Edition
Symbian

Artigo
Palavras-chave: device.getServiceObject(), Service.SysInfo, Service.SysInfo.GetInfo()
Tradução:
Por thiagobrunoms
Última alteração feita por hamishwillee em 08 May 2013

Contents

Introdução

Este código demonstra como obter um número IMEI do dispositivo utilizando a API SystemInfo Service do Web Runtime (WRT) 1.1.


Nota: A API SystemInfo Service do WRT 1.1 está apenas disponível para dispositivos S60 5a edição.

Código-fonte: index.html

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript" src="basic.js"></script>
<script type="text/javascript" src="WRTKit/WRTKit.js"></script>
<style type="text/css">
@import url("basic.css");
</style>
</head>
<body onload="init()">
</body>
</html>

Código-fonte: basic.js

var systemServiceObj = null;
 
// Invocado pelo evento "onload" para inicializar o widget.
function init()
{
try
{
systemServiceObj = device.getServiceObject("Service.SysInfo", "ISysInfo");
}
catch (ex)
{
alert("System Service object cannot be found.");
return;
}
getIMEI();
}
 
// Informações do dispositivo
function getIMEI()
{
// Inicializa os critérios para o objeto de serviço para obter as informações
var criteria = new Object();
criteria.Entity = "Device";
criteria.Key = "IMEI";
try {
var result = systemServiceObj.ISysInfo.GetInfo(criteria);
}
catch (ex)
{
alert(ex);
return;
}
 
alert("IMEI: " + result.ReturnValue.StringData);
}

Pós-condições

  • O número IMEI do dispositivo será visualizado na tela

Materiais Complementares

This page was last modified on 8 May 2013, at 00:03.
169 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.

×