如何获得在PhoneGap的IMEI号? [英] How to get IMEI number in phonegap?

查看:230
本文介绍了如何获得在PhoneGap的IMEI号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用jQuery,JavaScript和HTML开发PhoneGap的Andr​​oid手机应用程序。我想获得移动IMEI。我试图从这个本教程code

i'm developing a phonegap android mobile application using jquery,javascript and html. I want to get the mobile IMEI .I have tried this code from this Tutorial.

我收到的数量( 97734a345d234d )像this.I检查了我的设备使用*#06#。我不知道它是否是正确的还是错误的。请好心指点我拿到IMEI号码。在此先感谢。

I am getting the number(97734a345d234d)like this.I have checked my device to get imei number using *#06#.I dunno whether it is correct or wrong .Please kindly guide me.Thanks in Advance.

推荐答案

取在延伸DroidGap类的类的IMEI号码,节省了IMEI号的值静态成员,然后在任何你想访问该静态字段。 ..例如code是这里

Fetch the IMEI number in the class which extends DroidGap class and save the value of imei number in static member and then access this static field from where ever you want... example code is here

public class MyApp extends DroidGap
{
    private static String imei; 
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        super.loadUrl("file:///android_asset/www/index.html");
        TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
        imei=tm.getDeviceId();
    }
    static public String getIMEI(){
        return imei;
    }
}
// where ever u need imei number use this code

String imei=MyApp.getIMEI();

这篇关于如何获得在PhoneGap的IMEI号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆