CB-5504: Moving Telephony Logic out of Device
Project: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/commit/695272e6 Tree: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/tree/695272e6 Diff: http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/diff/695272e6 Branch: refs/heads/master Commit: 695272e6da9c168decdb6dd9f7a9383b65ad058c Parents: 495f94a Author: Joe Bowser <[email protected]> Authored: Mon Dec 9 14:05:34 2013 -0800 Committer: Joe Bowser <[email protected]> Committed: Mon Dec 9 14:05:34 2013 -0800 ---------------------------------------------------------------------- src/android/Device.java | 40 ---------------------------------------- 1 file changed, 40 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-plugin-device/blob/695272e6/src/android/Device.java ---------------------------------------------------------------------- diff --git a/src/android/Device.java b/src/android/Device.java index fe5dd14..603ea37 100644 --- a/src/android/Device.java +++ b/src/android/Device.java @@ -65,7 +65,6 @@ public class Device extends CordovaPlugin { public void initialize(CordovaInterface cordova, CordovaWebView webView) { super.initialize(cordova, webView); Device.uuid = getUuid(); - this.initTelephonyReceiver(); } /** @@ -104,45 +103,6 @@ public class Device extends CordovaPlugin { //-------------------------------------------------------------------------- /** - * Listen for telephony events: RINGING, OFFHOOK and IDLE - * Send these events to all plugins using - * CordovaActivity.onMessage("telephone", "ringing" | "offhook" | "idle") - */ - private void initTelephonyReceiver() { - IntentFilter intentFilter = new IntentFilter(); - intentFilter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED); - //final CordovaInterface mycordova = this.cordova; - this.telephonyReceiver = new BroadcastReceiver() { - - @Override - public void onReceive(Context context, Intent intent) { - - // If state has changed - if ((intent != null) && intent.getAction().equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)) { - if (intent.hasExtra(TelephonyManager.EXTRA_STATE)) { - String extraData = intent.getStringExtra(TelephonyManager.EXTRA_STATE); - if (extraData.equals(TelephonyManager.EXTRA_STATE_RINGING)) { - LOG.i(TAG, "Telephone RINGING"); - webView.postMessage("telephone", "ringing"); - } - else if (extraData.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) { - LOG.i(TAG, "Telephone OFFHOOK"); - webView.postMessage("telephone", "offhook"); - } - else if (extraData.equals(TelephonyManager.EXTRA_STATE_IDLE)) { - LOG.i(TAG, "Telephone IDLE"); - webView.postMessage("telephone", "idle"); - } - } - } - } - }; - - // Register the receiver - this.cordova.getActivity().registerReceiver(this.telephonyReceiver, intentFilter); - } - - /** * Get the OS name. * * @return
