UUID Support

This commit is contained in:
Wei Zhang
2015-03-05 22:31:35 +00:00
committed by Erjan Gavalji
parent c5bf366f63
commit 8a0c0dd281
3 changed files with 33 additions and 4 deletions

View File

@ -16,6 +16,7 @@ export class device implements definition.device {
private static _osVersion: string; private static _osVersion: string;
private static _sdkVersion: string; private static _sdkVersion: string;
private static _deviceType: string; private static _deviceType: string;
private static _uuid: string;
static get os(): string { static get os(): string {
return platformNames.android; return platformNames.android;
@ -60,6 +61,17 @@ export class device implements definition.device {
return device._deviceType; return device._deviceType;
} }
static get uuid(): string {
if (!device._uuid) {
device._uuid = android.provider.Settings.Secure.getString(
application.android.context.getContentResolver(),
android.provider.Settings.Secure.ANDROID_ID
);
}
return device._uuid;
}
} }
var mainScreenInfo: definition.ScreenMetrics; var mainScreenInfo: definition.ScreenMetrics;

View File

@ -45,6 +45,11 @@ declare module "platform" {
* Available values: "phone", "tablet". * Available values: "phone", "tablet".
*/ */
static deviceType: string; static deviceType: string;
/**
* Gets the uuid
*/
static uuid: string;
} }
/** /**

View File

@ -55,6 +55,18 @@ export class device implements definition.device {
return device._deviceType; return device._deviceType;
} }
static get uuid(): string {
if (!device._uuid) {
/*NSUserDefaults* userDefaults = [NSUserDefaults standardUserDefaults];
var UUID_KEY = @"CDVUUID";
CFUUIDRef uuidRef = CFUUIDCreate(kCFAllocatorDefault);
CFStringRef uuidString = CFUUIDCreateString(kCFAllocatorDefault, uuidRef);
*/
}
return device._uuid;
}
} }
var mainScreenInfo: definition.ScreenMetrics = null; var mainScreenInfo: definition.ScreenMetrics = null;