2012-07-18 20 views
1

我們可以找到Android的唯一的ID全光照像本地代碼 -Android的ID與PhoneGap的

import android.provider.Settings.Secure; 

private String android_id = Secure.getString(getContext().getContentResolver(), 
                Secure.ANDROID_ID); 

但請建議我是他們的任何方式使用PhoneGap的做同樣的事情?

回答

0

其實,這是默認的行爲,當你調用device.uuid,至少在PhoneGap的3.5.0。你可以看到,如果你檢查的源代碼org.apache.cordova.device.Device

public class Device extends CordovaPlugin { 
... 
    /** 
    * Get the device's Universally Unique Identifier (UUID). 
    * 
    * @return 
    */ 
    public String getUuid() { 
     String uuid = Settings.Secure.getString(this.cordova.getActivity().getContentResolver(), android.provider.Settings.Secure.ANDROID_ID); 
     return uuid; 
    } 
... 
}