From a65b5784492044324b49d8b9d078a54ba8876ac1 Mon Sep 17 00:00:00 2001 From: Igor Anic Date: Fri, 23 Apr 2010 10:49:47 +0200 Subject: [PATCH] adding useful telephony information to Device; sim serial number and some oters (cherry picked from commit da8c4f4a7539b2e6165d48ad6859f65c3133fc59) --- framework/assets/js/device.js | 6 +++++- framework/src/com/phonegap/PhoneGap.java | 18 +++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/framework/assets/js/device.js b/framework/assets/js/device.js index c23f2b18..d6be6016 100644 --- a/framework/assets/js/device.js +++ b/framework/assets/js/device.js @@ -17,7 +17,11 @@ function Device() { this.version = window.DroidGap.getOSVersion(); this.gapVersion = window.DroidGap.getVersion(); this.platform = window.DroidGap.getPlatform(); - this.name = window.DroidGap.getProductName(); + this.name = window.DroidGap.getProductName(); + this.line1Number = window.DroidGap.getLine1Number(); + this.deviceId = window.DroidGap.getDeviceId(); + this.simSerialNumber = window.DroidGap.getSimSerialNumber(); + this.subscriberId = window.DroidGap.getSubscriberId(); } } catch(e) { this.available = false; diff --git a/framework/src/com/phonegap/PhoneGap.java b/framework/src/com/phonegap/PhoneGap.java index 262380b4..6dc00a8d 100644 --- a/framework/src/com/phonegap/PhoneGap.java +++ b/framework/src/com/phonegap/PhoneGap.java @@ -86,7 +86,23 @@ public class PhoneGap{ String uuid = Settings.Secure.getString(mCtx.getContentResolver(), android.provider.Settings.Secure.ANDROID_ID); return uuid; } - + + public String getLine1Number(){ + TelephonyManager operator = (TelephonyManager)mCtx.getSystemService(Context.TELEPHONY_SERVICE); + return operator.getLine1Number(); + } + public String getDeviceId(){ + TelephonyManager operator = (TelephonyManager)mCtx.getSystemService(Context.TELEPHONY_SERVICE); + return operator.getDeviceId(); + } + public String getSimSerialNumber(){ + TelephonyManager operator = (TelephonyManager)mCtx.getSystemService(Context.TELEPHONY_SERVICE); + return operator.getSimSerialNumber(); + } + public String getSubscriberId(){ + TelephonyManager operator = (TelephonyManager)mCtx.getSystemService(Context.TELEPHONY_SERVICE); + return operator.getSubscriberId(); + } public String getModel() {