├── LICENSE
├── README.md
├── android
├── .gitignore
├── LICENSE
├── assets
│ └── README
├── build.xml
├── dist
│ ├── com.goyya.telephonymanager-android-1.0.1.zip
│ ├── com.goyya.telephonymanager-android-2.0.0.zip
│ └── telephonymanager.jar
├── documentation
│ └── index.md
├── example
│ └── app.js
├── java-sources.txt
├── lib
│ └── README
├── manifest
├── platform
│ └── README
├── src
│ └── com
│ │ └── goyya
│ │ └── telephonymanager
│ │ └── TelephonyManagerModule.java
└── timodule.xml
├── assets
└── README
├── documentation
└── index.md
└── example
└── app.js
/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 GOYYA Systems GmbH & Co. KG
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Titanium TelephonyManager [](http://gitt.io/component/com.goyya.telephonymanager)
2 | > Titanium Module for accessing the Android TelephonyManager
3 |
4 | ## Description
5 |
6 | This module exposes the Android [TelephonyManager](http://developer.android.com/reference/android/telephony/TelephonyManager.html) to Titanium.
7 |
8 | (If you are looking for something similar for iOS you should check out David Bankier's [CoreTelephony ](https://github.com/dbankier/CoreTelephony-for-Appcelerator-Titanium) module)
9 |
10 | ## Quick Start
11 |
12 | ### Installation
13 | Download the latest distribution ZIP-file and consult the [Titanium Documentation](http://docs.appcelerator.com/titanium/latest/#!/guide/Using_a_Module) on how install it, or simply use the [gitTio CLI](http://gitt.io/cli):
14 |
15 | `$ gittio install com.goyya.telephonymanager`
16 |
17 | ### Usage
18 |
19 | For the full API documentation please see [here](http://developer.android.com/reference/android/telephony/TelephonyManager.html)
20 |
21 | ```javascript
22 | var telephonymanager = require("com.goyya.telephonymanager");
23 |
24 | // these are just some infos you can get
25 | console.log('callState: ' + telephonymanager.callState);
26 | console.log('deviceId: ' + telephonymanager.deviceId);
27 | console.log('deviceSoftwareVersion: ' + telephonymanager.deviceSoftwareVersion);
28 | console.log('phoneNumber: ' + telephonymanager.line1Number);
29 | console.log('networkOperator: ' + telephonymanager.networkOperator);
30 | console.log('networkOperatorName: ' + telephonymanager.networkOperatorName);
31 | console.log('networkType: ' + telephonymanager.networkType);
32 | console.log('phoneType: ' + telephonymanager.phoneType);
33 | console.log('simOperator: ' + telephonymanager.simOperator);
34 | console.log('simOperatorName: ' + telephonymanager.simOperatorName);
35 | console.log('simSerialNumber: ' + telephonymanager.simSerialNumber);
36 | console.log('simState: ' + telephonymanager.simState);
37 | console.log('voiceMailNumber: ' + telephonymanager.voiceMailNumber);
38 | console.log('isNetworkRoaming: ' + telephonymanager.isNetworkRoaming);
39 | console.log('isSmsCapable: ' + telephonymanager.isSmsCapable);
40 | console.log('isVoiceCapable: ' + telephonymanager.isVoiceCapable);
41 | ```
42 |
43 | > NOTE: This module automatically adds the `READ_PHONE_STATE` permission to your manifest. If you are using methods of the TelephonyManager that are requiring any other permission, please add it manually to your tiapp.xml
44 |
45 | ## API Documentation
46 |
47 | ### Properties
48 |
49 | * `callState` _(Number)_
50 | * `CALL_STATE_RINGING`
51 | * `CALL_STATE_OFFHOOK`
52 | * `CALL_STATE_IDLE`
53 | * `dataActivity` _(Number)_
54 | * `DATA_ACTIVITY_NONE`
55 | * `DATA_ACTIVITY_IN`
56 | * `DATA_ACTIVITY_OUT`
57 | * `DATA_ACTIVITY_INOUT`
58 | * `DATA_ACTIVITY_DORMANT`
59 | * `dataState` _(Number)_
60 | * `DATA_DISCONNECTED`
61 | * `DATA_CONNECTING`
62 | * `DATA_CONNECTED`
63 | * `DATA_SUSPENDED`
64 | * `deviceId` _(String)_
65 | * `deviceSoftwareVersion` _(String)_
66 | * `groupIdLevel1` _(String)_
67 | * `line1Number` _(String)_
68 | * `mmsUAProfUrl` _(String)_
69 | * `mmsUserAgent` _(String)_
70 | * `networkCountryIso` _(String)_
71 | * `networkOperator` _(String)_
72 | * `networkOperatorName` _(String)_
73 | * `networkType` _(Number)_
74 | * `NETWORK_TYPE_1xRTT`
75 | * `NETWORK_TYPE_CDMA`
76 | * `NETWORK_TYPE_EDGE`
77 | * `NETWORK_TYPE_EHRPD`
78 | * `NETWORK_TYPE_EVDO_0`
79 | * `NETWORK_TYPE_EVDO_A`
80 | * `NETWORK_TYPE_EVDO_B`
81 | * `NETWORK_TYPE_GPRS`
82 | * `NETWORK_TYPE_HSDPA`
83 | * `NETWORK_TYPE_HSPA`
84 | * `NETWORK_TYPE_HSPAP`
85 | * `NETWORK_TYPE_HSUPA`
86 | * `NETWORK_TYPE_IDEN`
87 | * `NETWORK_TYPE_LTE`
88 | * `NETWORK_TYPE_UMTS`
89 | * `NETWORK_TYPE_UNKNOWN`
90 | * `phoneType` _(Number)_
91 | * `PHONE_TYPE_NONE`
92 | * `PHONE_TYPE_GSM`
93 | * `PHONE_TYPE_CDMA`
94 | * `PHONE_TYPE_SIP`
95 | * `simCountryIso` _(String)_
96 | * `simOperator` _(String)_
97 | * `simOperatorName` _(String)_
98 | * `simSerialNumber` _(String)_
99 | * `simState` _(Number)_
100 | * `SIM_STATE_UNKNOWN`
101 | * `SIM_STATE_ABSENT`
102 | * `SIM_STATE_PIN_REQUIRED`
103 | * `SIM_STATE_PUK_REQUIRED`
104 | * `SIM_STATE_NETWORK_LOCKED`
105 | * `SIM_STATE_READY`
106 | * `subscriberId` _(String)_
107 | * `voiceMailAlphaTag` _(String)_
108 | * `voiceMailNumber` _(String)_
109 | * `hasCarrierPrivileges` _(Boolean)_
110 | * `hasIccCard` _(Boolean)_
111 | * `isNetworkRoaming` _(Boolean)_
112 | * `isSmsCapable` _(Boolean)_
113 | * `isVoiceCapable` _(Boolean)_
114 |
115 |
116 | ### Events
117 |
118 | * `callForwardingIndicator`
119 | * `callState`
120 | * `cellInfo`
121 | * `cellLocation`
122 | * `dataActivity`
123 | * `dataConnectionState`
124 | * `messageWaitingIndicator`
125 | * `serviceState`
126 | * `signalStrengths`
127 |
128 | ## License
129 |
130 | [The MIT License (MIT)](LICENSE)
131 |
--------------------------------------------------------------------------------
/android/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | tmp
3 | bin
4 | build
5 | .apt_generated
6 | .project
7 | .classpath
8 | .settings
9 | libs
10 | build.properties
11 | *.apk
12 |
--------------------------------------------------------------------------------
/android/LICENSE:
--------------------------------------------------------------------------------
1 | The MIT License (MIT)
2 |
3 | Copyright (c) 2015 GOYYA Systems GmbH & Co. KG
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
--------------------------------------------------------------------------------
/android/assets/README:
--------------------------------------------------------------------------------
1 | Place your assets like PNG files in this directory and they will be packaged
2 | with your module.
3 |
4 | All JavaScript files in the assets directory are IGNORED except if you create a
5 | file named "com.goyya.telephonymanager.js" in this directory in which case it will be
6 | wrapped by native code, compiled, and used as your module. This allows you to
7 | run pure JavaScript modules that are pre-compiled.
8 |
9 | Note: Mobile Web does not support this assets directory.
10 |
--------------------------------------------------------------------------------
/android/build.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | Ant build script for Titanium Android module TelephonyManager
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
--------------------------------------------------------------------------------
/android/dist/com.goyya.telephonymanager-android-1.0.1.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manumaticx/TelephonyManager/03ca3effa56d4e29189f5e8519ad07a786575ca1/android/dist/com.goyya.telephonymanager-android-1.0.1.zip
--------------------------------------------------------------------------------
/android/dist/com.goyya.telephonymanager-android-2.0.0.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manumaticx/TelephonyManager/03ca3effa56d4e29189f5e8519ad07a786575ca1/android/dist/com.goyya.telephonymanager-android-2.0.0.zip
--------------------------------------------------------------------------------
/android/dist/telephonymanager.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manumaticx/TelephonyManager/03ca3effa56d4e29189f5e8519ad07a786575ca1/android/dist/telephonymanager.jar
--------------------------------------------------------------------------------
/android/documentation/index.md:
--------------------------------------------------------------------------------
1 | # Titanium TelephonyManager [](http://gitt.io/component/com.goyya.telephonymanager)
2 | > Titanium Module for accessing the Android TelephonyManager
3 |
4 | ## Description
5 |
6 | This module exposes the Android [TelephonyManager](http://developer.android.com/reference/android/telephony/TelephonyManager.html) to Titanium.
7 |
8 | (If you are looking for something similar for iOS you should check out David Bankier's [CoreTelephony ](https://github.com/dbankier/CoreTelephony-for-Appcelerator-Titanium) module)
9 |
10 | ## Quick Start
11 |
12 | ### Installation
13 | Download the latest distribution ZIP-file and consult the [Titanium Documentation](http://docs.appcelerator.com/titanium/latest/#!/guide/Using_a_Module) on how install it, or simply use the [gitTio CLI](http://gitt.io/cli):
14 |
15 | `$ gittio install com.goyya.telephonymanager`
16 |
17 | ### Usage
18 |
19 | For the full API documentation please see [here](http://developer.android.com/reference/android/telephony/TelephonyManager.html)
20 |
21 | ```javascript
22 | var telephonymanager = require("com.goyya.telephonymanager");
23 |
24 | // these are just some infos you can get
25 | console.log('callState: ' + telephonymanager.callState);
26 | console.log('deviceId: ' + telephonymanager.deviceId);
27 | console.log('deviceSoftwareVersion: ' + telephonymanager.deviceSoftwareVersion);
28 | console.log('phoneNumber: ' + telephonymanager.line1Number);
29 | console.log('networkOperator: ' + telephonymanager.networkOperator);
30 | console.log('networkOperatorName: ' + telephonymanager.networkOperatorName);
31 | console.log('networkType: ' + telephonymanager.networkType);
32 | console.log('phoneType: ' + telephonymanager.phoneType);
33 | console.log('simOperator: ' + telephonymanager.simOperator);
34 | console.log('simOperatorName: ' + telephonymanager.simOperatorName);
35 | console.log('simSerialNumber: ' + telephonymanager.simSerialNumber);
36 | console.log('simState: ' + telephonymanager.simState);
37 | console.log('voiceMailNumber: ' + telephonymanager.voiceMailNumber);
38 | console.log('isNetworkRoaming: ' + telephonymanager.isNetworkRoaming);
39 | console.log('isSmsCapable: ' + telephonymanager.isSmsCapable);
40 | console.log('isVoiceCapable: ' + telephonymanager.isVoiceCapable);
41 | ```
42 |
43 | > NOTE: This module automatically adds the `READ_PHONE_STATE` permission to your manifest. If you are using methods of the TelephonyManager that are requiring any other permission, please add it manually to your tiapp.xml
44 |
45 | ## API Documentation
46 |
47 | ### Properties
48 |
49 | * `callState` _(Number)_
50 | * `CALL_STATE_RINGING`
51 | * `CALL_STATE_OFFHOOK`
52 | * `CALL_STATE_IDLE`
53 | * `dataActivity` _(Number)_
54 | * `DATA_ACTIVITY_NONE`
55 | * `DATA_ACTIVITY_IN`
56 | * `DATA_ACTIVITY_OUT`
57 | * `DATA_ACTIVITY_INOUT`
58 | * `DATA_ACTIVITY_DORMANT`
59 | * `dataState` _(Number)_
60 | * `DATA_DISCONNECTED`
61 | * `DATA_CONNECTING`
62 | * `DATA_CONNECTED`
63 | * `DATA_SUSPENDED`
64 | * `deviceId` _(String)_
65 | * `deviceSoftwareVersion` _(String)_
66 | * `groupIdLevel1` _(String)_
67 | * `line1Number` _(String)_
68 | * `mmsUAProfUrl` _(String)_
69 | * `mmsUserAgent` _(String)_
70 | * `networkCountryIso` _(String)_
71 | * `networkOperator` _(String)_
72 | * `networkOperatorName` _(String)_
73 | * `networkType` _(Number)_
74 | * `NETWORK_TYPE_1xRTT`
75 | * `NETWORK_TYPE_CDMA`
76 | * `NETWORK_TYPE_EDGE`
77 | * `NETWORK_TYPE_EHRPD`
78 | * `NETWORK_TYPE_EVDO_0`
79 | * `NETWORK_TYPE_EVDO_A`
80 | * `NETWORK_TYPE_EVDO_B`
81 | * `NETWORK_TYPE_GPRS`
82 | * `NETWORK_TYPE_HSDPA`
83 | * `NETWORK_TYPE_HSPA`
84 | * `NETWORK_TYPE_HSPAP`
85 | * `NETWORK_TYPE_HSUPA`
86 | * `NETWORK_TYPE_IDEN`
87 | * `NETWORK_TYPE_LTE`
88 | * `NETWORK_TYPE_UMTS`
89 | * `NETWORK_TYPE_UNKNOWN`
90 | * `phoneType` _(Number)_
91 | * `PHONE_TYPE_NONE`
92 | * `PHONE_TYPE_GSM`
93 | * `PHONE_TYPE_CDMA`
94 | * `PHONE_TYPE_SIP`
95 | * `simCountryIso` _(String)_
96 | * `simOperator` _(String)_
97 | * `simOperatorName` _(String)_
98 | * `simSerialNumber` _(String)_
99 | * `simState` _(Number)_
100 | * `SIM_STATE_UNKNOWN`
101 | * `SIM_STATE_ABSENT`
102 | * `SIM_STATE_PIN_REQUIRED`
103 | * `SIM_STATE_PUK_REQUIRED`
104 | * `SIM_STATE_NETWORK_LOCKED`
105 | * `SIM_STATE_READY`
106 | * `subscriberId` _(String)_
107 | * `voiceMailAlphaTag` _(String)_
108 | * `voiceMailNumber` _(String)_
109 | * `hasCarrierPrivileges` _(Boolean)_
110 | * `hasIccCard` _(Boolean)_
111 | * `isNetworkRoaming` _(Boolean)_
112 | * `isSmsCapable` _(Boolean)_
113 | * `isVoiceCapable` _(Boolean)_
114 |
115 |
116 | ### Events
117 |
118 | * `callForwardingIndicator`
119 | * `callState`
120 | * `cellInfo`
121 | * `cellLocation`
122 | * `dataActivity`
123 | * `dataConnectionState`
124 | * `messageWaitingIndicator`
125 | * `serviceState`
126 | * `signalStrengths`
--------------------------------------------------------------------------------
/android/example/app.js:
--------------------------------------------------------------------------------
1 | var telephonymanager = require('com.goyya.telephonymanager');
2 |
3 | console.log('callState: ' + telephonymanager.callState);
4 | console.log('dataActivity: ' + telephonymanager.dataActivity);
5 | console.log('dataState: ' + telephonymanager.dataState);
6 | console.log('deviceId: ' + telephonymanager.deviceId);
7 | console.log('deviceSoftwareVersion: ' + telephonymanager.deviceSoftwareVersion);
8 | console.log('groupIdLevel1: ' + telephonymanager.groupIdLevel1);
9 | console.log('line1Number: ' + telephonymanager.line1Number);
10 | console.log('mmsUAProfUrl: ' + telephonymanager.mmsUAProfUrl);
11 | console.log('mmsUserAgent: ' + telephonymanager.mmsUserAgent);
12 | console.log('networkCountryIso: ' + telephonymanager.networkCountryIso);
13 | console.log('networkOperator: ' + telephonymanager.networkOperator);
14 | console.log('networkOperatorName: ' + telephonymanager.networkOperatorName);
15 | console.log('networkType: ' + telephonymanager.networkType);
16 | console.log('phoneType: ' + telephonymanager.phoneType);
17 | console.log('simCountryIso: ' + telephonymanager.simCountryIso);
18 | console.log('simOperator: ' + telephonymanager.simOperator);
19 | console.log('simOperatorName: ' + telephonymanager.simOperatorName);
20 | console.log('simSerialNumber: ' + telephonymanager.simSerialNumber);
21 | console.log('simState: ' + telephonymanager.simState);
22 | console.log('subscriberId: ' + telephonymanager.subscriberId);
23 | console.log('voiceMailAlphaTag: ' + telephonymanager.voiceMailAlphaTag);
24 | console.log('voiceMailNumber: ' + telephonymanager.voiceMailNumber);
25 | console.log('hasCarrierPrivileges: ' + telephonymanager.hasCarrierPrivileges);
26 | console.log('hasIccCard: ' + telephonymanager.hasIccCard);
27 | console.log('isNetworkRoaming: ' + telephonymanager.isNetworkRoaming);
28 | console.log('isSmsCapable: ' + telephonymanager.isSmsCapable);
29 | console.log('isVoiceCapable: ' + telephonymanager.isVoiceCapable);
--------------------------------------------------------------------------------
/android/java-sources.txt:
--------------------------------------------------------------------------------
1 | "/Users/macbook/Ti_Workspace/TelephonyManager/android/src/com/goyya/telephonymanager/TelephonyManagerModule.java"
2 | "/Users/macbook/Ti_Workspace/TelephonyManager/android/build/generated/java/com/goyya/telephonymanager/TelephonyManagerBootstrap.java"
3 | "/Users/macbook/Ti_Workspace/TelephonyManager/android/build/generated/r/android/support/compat/R.java"
4 | "/Users/macbook/Ti_Workspace/TelephonyManager/android/build/generated/r/android/support/coreui/R.java"
5 | "/Users/macbook/Ti_Workspace/TelephonyManager/android/build/generated/r/android/support/coreutils/R.java"
6 | "/Users/macbook/Ti_Workspace/TelephonyManager/android/build/generated/r/android/support/design/R.java"
7 | "/Users/macbook/Ti_Workspace/TelephonyManager/android/build/generated/r/android/support/exifinterface/R.java"
8 | "/Users/macbook/Ti_Workspace/TelephonyManager/android/build/generated/r/android/support/fragment/R.java"
9 | "/Users/macbook/Ti_Workspace/TelephonyManager/android/build/generated/r/android/support/graphics/drawable/R.java"
10 | "/Users/macbook/Ti_Workspace/TelephonyManager/android/build/generated/r/android/support/graphics/drawable/animated/R.java"
11 | "/Users/macbook/Ti_Workspace/TelephonyManager/android/build/generated/r/android/support/mediacompat/R.java"
12 | "/Users/macbook/Ti_Workspace/TelephonyManager/android/build/generated/r/android/support/transition/R.java"
13 | "/Users/macbook/Ti_Workspace/TelephonyManager/android/build/generated/r/android/support/v4/R.java"
14 | "/Users/macbook/Ti_Workspace/TelephonyManager/android/build/generated/r/android/support/v7/appcompat/R.java"
15 | "/Users/macbook/Ti_Workspace/TelephonyManager/android/build/generated/r/android/support/v7/cardview/R.java"
16 | "/Users/macbook/Ti_Workspace/TelephonyManager/android/build/generated/r/android/support/v7/recyclerview/R.java"
17 | "/Users/macbook/Ti_Workspace/TelephonyManager/android/build/generated/r/com/goyya/telephonymanager/R.java"
18 | "/Users/macbook/Ti_Workspace/TelephonyManager/android/build/generated/r/ti/modules/titanium/ui/R.java"
--------------------------------------------------------------------------------
/android/lib/README:
--------------------------------------------------------------------------------
1 | You can place any .jar dependencies in this directory and they will be included
2 | when your module is being compiled.
--------------------------------------------------------------------------------
/android/manifest:
--------------------------------------------------------------------------------
1 | #
2 | # this is your module manifest and used by Titanium
3 | # during compilation, packaging, distribution, etc.
4 | #
5 | version: 2.0.0
6 | apiversion: 4
7 | architectures: arm64-v8a armeabi-v7a x86
8 | description: TelephonyManager
9 | author: Manuel Lehner
10 | license: MIT
11 | copyright: Copyright (c) 2015 by GOYYA Systems GmbH & Co.KG
12 |
13 | # these should not be edited
14 | name: TelephonyManager
15 | moduleid: com.goyya.telephonymanager
16 | guid: dafe8862-2963-4f59-9d8c-f25e62ef1b7e
17 | platform: android
18 | minsdk: 7.5.0.GA
19 |
--------------------------------------------------------------------------------
/android/platform/README:
--------------------------------------------------------------------------------
1 | You can place platform-specific files here in sub-folders named "android" and/or "iphone", just as you can with normal Titanium Mobile SDK projects. Any folders and files you place here will be merged with the platform-specific files in a Titanium Mobile project that uses this module.
2 |
3 | When a Titanium Mobile project that uses this module is built, the files from this platform/ folder will be treated the same as files (if any) from the Titanium Mobile project's platform/ folder.
4 |
--------------------------------------------------------------------------------
/android/src/com/goyya/telephonymanager/TelephonyManagerModule.java:
--------------------------------------------------------------------------------
1 | /**
2 | * TelephonyManager Android Module for Titanium
3 | * Copyright (c) 2015 by GOYYA Systems GmbH & Co.KG
4 | */
5 | package com.goyya.telephonymanager;
6 |
7 | import org.appcelerator.kroll.KrollModule;
8 | import org.appcelerator.kroll.KrollProxy;
9 | import org.appcelerator.kroll.annotations.Kroll;
10 | import org.appcelerator.titanium.TiApplication;
11 | import org.appcelerator.kroll.common.Log;
12 | import org.appcelerator.kroll.common.TiConfig;
13 |
14 | import java.util.List;
15 | import java.util.HashMap;
16 |
17 | import android.os.Build;
18 | import android.content.Context;
19 | import android.telephony.TelephonyManager;
20 | import android.telephony.PhoneStateListener;
21 | import android.telephony.CellInfo;
22 | import android.telephony.CellLocation;
23 | import android.telephony.ServiceState;
24 | import android.telephony.SignalStrength;
25 |
26 | @Kroll.module(name = "TelephonyManager", id = "com.goyya.telephonymanager")
27 | public class TelephonyManagerModule extends KrollModule {
28 |
29 | private static final String LCAT = "TelephonyManagerModule";
30 | private static final boolean DBG = TiConfig.LOGD;
31 | private static TelephonyManager tm;
32 | private PhoneStateListener psl;
33 | private int events = PhoneStateListener.LISTEN_NONE;
34 |
35 | // constants
36 | @Kroll.constant
37 | public static final String EVENT_CALL_FORWARDING_INDICATOR = "callForwardingIndicator";
38 | @Kroll.constant
39 | public static final String EVENT_CALL_STATE = "callState";
40 | @Kroll.constant
41 | public static final String EVENT_CELL_INFO = "cellInfo";
42 | @Kroll.constant
43 | public static final String EVENT_CELL_LOCATION = "cellLocation";
44 | @Kroll.constant
45 | public static final String EVENT_DATA_ACTIVITY = "dataActivity";
46 | @Kroll.constant
47 | public static final String EVENT_DATA_CONNECTION_STATE = "dataConnectionState";
48 | @Kroll.constant
49 | public static final String EVENT_MESSAGE_WAITING_INDICATOR = "messageWaitingIndicator";
50 | @Kroll.constant
51 | public static final String EVENT_SERVICE_STATE = "serviceState";
52 | @Kroll.constant
53 | public static final String EVENT_SIGNAL_STRENGTHS = "signalStrengths";
54 |
55 | @Kroll.constant
56 | public static final int CALL_STATE_RINGING = TelephonyManager.CALL_STATE_RINGING;
57 | @Kroll.constant
58 | public static final int CALL_STATE_OFFHOOK = TelephonyManager.CALL_STATE_OFFHOOK;
59 | @Kroll.constant
60 | public static final int CALL_STATE_IDLE = TelephonyManager.CALL_STATE_IDLE;
61 |
62 | @Kroll.constant
63 | public static final int DATA_ACTIVITY_NONE = TelephonyManager.DATA_ACTIVITY_NONE;
64 | @Kroll.constant
65 | public static final int DATA_ACTIVITY_IN = TelephonyManager.DATA_ACTIVITY_IN;
66 | @Kroll.constant
67 | public static final int DATA_ACTIVITY_OUT = TelephonyManager.DATA_ACTIVITY_OUT;
68 | @Kroll.constant
69 | public static final int DATA_ACTIVITY_INOUT = TelephonyManager.DATA_ACTIVITY_INOUT;
70 | @Kroll.constant
71 | public static final int DATA_ACTIVITY_DORMANT = TelephonyManager.DATA_ACTIVITY_DORMANT;
72 | @Kroll.constant
73 | public static final int DATA_DISCONNECTED = TelephonyManager.DATA_DISCONNECTED;
74 | @Kroll.constant
75 | public static final int DATA_CONNECTING = TelephonyManager.DATA_CONNECTING;
76 | @Kroll.constant
77 | public static final int DATA_CONNECTED = TelephonyManager.DATA_CONNECTED;
78 | @Kroll.constant
79 | public static final int DATA_SUSPENDED = TelephonyManager.DATA_SUSPENDED;
80 |
81 | @Kroll.constant
82 | public static final int NETWORK_TYPE_1xRTT = TelephonyManager.NETWORK_TYPE_1xRTT;
83 | @Kroll.constant
84 | public static final int NETWORK_TYPE_CDMA = TelephonyManager.NETWORK_TYPE_CDMA;
85 | @Kroll.constant
86 | public static final int NETWORK_TYPE_EDGE = TelephonyManager.NETWORK_TYPE_EDGE;
87 | @Kroll.constant
88 | public static final int NETWORK_TYPE_EHRPD = TelephonyManager.NETWORK_TYPE_EHRPD;
89 | @Kroll.constant
90 | public static final int NETWORK_TYPE_EVDO_0 = TelephonyManager.NETWORK_TYPE_EVDO_0;
91 | @Kroll.constant
92 | public static final int NETWORK_TYPE_EVDO_A = TelephonyManager.NETWORK_TYPE_EVDO_A;
93 | @Kroll.constant
94 | public static final int NETWORK_TYPE_EVDO_B = TelephonyManager.NETWORK_TYPE_EVDO_B;
95 | @Kroll.constant
96 | public static final int NETWORK_TYPE_GPRS = TelephonyManager.NETWORK_TYPE_GPRS;
97 | @Kroll.constant
98 | public static final int NETWORK_TYPE_HSDPA = TelephonyManager.NETWORK_TYPE_HSDPA;
99 | @Kroll.constant
100 | public static final int NETWORK_TYPE_HSPA = TelephonyManager.NETWORK_TYPE_HSPA;
101 | @Kroll.constant
102 | public static final int NETWORK_TYPE_HSPAP = TelephonyManager.NETWORK_TYPE_HSPAP;
103 | @Kroll.constant
104 | public static final int NETWORK_TYPE_HSUPA = TelephonyManager.NETWORK_TYPE_HSUPA;
105 | @Kroll.constant
106 | public static final int NETWORK_TYPE_IDEN = TelephonyManager.NETWORK_TYPE_IDEN;
107 | @Kroll.constant
108 | public static final int NETWORK_TYPE_LTE = TelephonyManager.NETWORK_TYPE_LTE;
109 | @Kroll.constant
110 | public static final int NETWORK_TYPE_UMTS = TelephonyManager.NETWORK_TYPE_UMTS;
111 | @Kroll.constant
112 | public static final int NETWORK_TYPE_UNKNOWN = TelephonyManager.NETWORK_TYPE_UNKNOWN;
113 |
114 | @Kroll.constant
115 | public static final int PHONE_TYPE_NONE = TelephonyManager.PHONE_TYPE_NONE;
116 | @Kroll.constant
117 | public static final int PHONE_TYPE_GSM = TelephonyManager.PHONE_TYPE_GSM;
118 | @Kroll.constant
119 | public static final int PHONE_TYPE_CDMA = TelephonyManager.PHONE_TYPE_CDMA;
120 | @Kroll.constant
121 | public static final int PHONE_TYPE_SIP = TelephonyManager.PHONE_TYPE_SIP;
122 |
123 | @Kroll.constant
124 | public static final int SIM_STATE_UNKNOWN = TelephonyManager.SIM_STATE_UNKNOWN;
125 | @Kroll.constant
126 | public static final int SIM_STATE_ABSENT = TelephonyManager.SIM_STATE_ABSENT;
127 | @Kroll.constant
128 | public static final int SIM_STATE_PIN_REQUIRED = TelephonyManager.SIM_STATE_PIN_REQUIRED;
129 | @Kroll.constant
130 | public static final int SIM_STATE_PUK_REQUIRED = TelephonyManager.SIM_STATE_PUK_REQUIRED;
131 | @Kroll.constant
132 | public static final int SIM_STATE_NETWORK_LOCKED = TelephonyManager.SIM_STATE_NETWORK_LOCKED;
133 | @Kroll.constant
134 | public static final int SIM_STATE_READY = TelephonyManager.SIM_STATE_READY;
135 |
136 | public TelephonyManagerModule() {
137 | super();
138 | }
139 |
140 | private TelephonyManager getManager() {
141 | if (tm != null) {
142 | return tm;
143 | }
144 |
145 | tm = (TelephonyManager) TiApplication.getAppRootOrCurrentActivity()
146 | .getSystemService(Context.TELEPHONY_SERVICE);
147 | return tm;
148 | }
149 |
150 | private PhoneStateListener getListener() {
151 | if (psl != null) {
152 | return psl;
153 | }
154 |
155 | psl = new PhoneStateListener() {
156 |
157 | @Override
158 | public void onCallForwardingIndicatorChanged(boolean cfi) {
159 | if (hasListeners(EVENT_CALL_FORWARDING_INDICATOR)) {
160 | HashMap event = new HashMap();
161 | event.put("cfi", cfi);
162 | fireEvent(EVENT_CALL_FORWARDING_INDICATOR, event);
163 | }
164 | }
165 |
166 | @Override
167 | public void onCallStateChanged(int state, String incomingNumber) {
168 | if (hasListeners(EVENT_CALL_STATE)) {
169 | HashMap event = new HashMap();
170 | event.put("state", state);
171 | event.put("incomingNumber", incomingNumber);
172 | fireEvent(EVENT_CALL_STATE, event);
173 | }
174 | }
175 |
176 | @Override
177 | public void onCellInfoChanged(List cellInfo) {
178 | if (hasListeners(EVENT_CELL_INFO)) {
179 | HashMap event = new HashMap();
180 | // TODO: add helper to convert CellInfo
181 | fireEvent(EVENT_CELL_INFO, event);
182 | }
183 | }
184 |
185 | @Override
186 | public void onCellLocationChanged(CellLocation location) {
187 | if (hasListeners(EVENT_CELL_LOCATION)) {
188 | HashMap event = new HashMap();
189 | // TODO: add helper to convert CellLocation
190 | fireEvent(EVENT_CELL_LOCATION, event);
191 | }
192 | }
193 |
194 | @Override
195 | public void onDataActivity(int direction) {
196 | if (hasListeners(EVENT_DATA_ACTIVITY)) {
197 | HashMap event = new HashMap();
198 | event.put("direction", direction);
199 | fireEvent(EVENT_DATA_ACTIVITY, event);
200 | }
201 | }
202 |
203 | @Override
204 | public void onDataConnectionStateChanged(int state) {
205 | if (hasListeners(EVENT_DATA_CONNECTION_STATE)) {
206 | HashMap event = new HashMap();
207 | event.put("state", state);
208 | fireEvent(EVENT_DATA_CONNECTION_STATE, event);
209 | }
210 | }
211 |
212 | @Override
213 | public void onDataConnectionStateChanged(int state, int networkType) {
214 | if (hasListeners(EVENT_DATA_CONNECTION_STATE)) {
215 | HashMap event = new HashMap();
216 | event.put("state", state);
217 | event.put("networkType", networkType);
218 | fireEvent(EVENT_DATA_CONNECTION_STATE, event);
219 | }
220 | }
221 |
222 | @Override
223 | public void onMessageWaitingIndicatorChanged(boolean mwi) {
224 | if (hasListeners(EVENT_MESSAGE_WAITING_INDICATOR)) {
225 | HashMap event = new HashMap();
226 | event.put("mwi", mwi);
227 | fireEvent(EVENT_MESSAGE_WAITING_INDICATOR, event);
228 | }
229 | }
230 |
231 | @Override
232 | public void onServiceStateChanged(ServiceState serviceState) {
233 | if (hasListeners(EVENT_SERVICE_STATE)) {
234 | HashMap event = new HashMap();
235 | // TODO: add helper to convert ServiceState
236 | fireEvent(EVENT_SERVICE_STATE, event);
237 | }
238 | }
239 |
240 | @Override
241 | public void onSignalStrengthsChanged(SignalStrength signalStrength) {
242 | if (hasListeners(EVENT_SIGNAL_STRENGTHS)) {
243 | HashMap event = new HashMap();
244 | // TODO: add helper to convert SignalStrength
245 | fireEvent(EVENT_SIGNAL_STRENGTHS, event);
246 | }
247 | }
248 | };
249 |
250 | return psl;
251 | }
252 |
253 | @Kroll.onAppCreate
254 | public static void onAppCreate(TiApplication app) {
255 |
256 | }
257 |
258 | @Kroll.method
259 | @Kroll.getProperty
260 | public int getCallState() {
261 | return getManager().getCallState();
262 | }
263 |
264 | @Kroll.method
265 | @Kroll.getProperty
266 | public int getDataActivity() {
267 | return getManager().getDataActivity();
268 | }
269 |
270 | @Kroll.method
271 | @Kroll.getProperty
272 | public int getDataState() {
273 | return getManager().getDataState();
274 | }
275 |
276 | @Kroll.method
277 | @Kroll.getProperty
278 | public String getDeviceId() {
279 | return getManager().getDeviceId();
280 | }
281 |
282 | @Kroll.method
283 | @Kroll.getProperty
284 | public String getDeviceSoftwareVersion() {
285 | return getManager().getDeviceSoftwareVersion();
286 | }
287 |
288 | @Kroll.method
289 | @Kroll.getProperty
290 | public String getGroupIdLevel1() {
291 | return getManager().getGroupIdLevel1();
292 | }
293 |
294 | @Kroll.method
295 | @Kroll.getProperty
296 | public String getLine1Number() {
297 | return getManager().getLine1Number();
298 | }
299 |
300 | @Kroll.method
301 | @Kroll.getProperty
302 | public String getMmsUAProfUrl() {
303 | return getManager().getMmsUAProfUrl();
304 | }
305 |
306 | @Kroll.method
307 | @Kroll.getProperty
308 | public String getMmsUserAgent() {
309 | return getManager().getMmsUserAgent();
310 | }
311 |
312 | @Kroll.method
313 | @Kroll.getProperty
314 | public String getNetworkCountryIso() {
315 | return getManager().getNetworkCountryIso();
316 | }
317 |
318 | @Kroll.method
319 | @Kroll.getProperty
320 | public String getNetworkOperator() {
321 | return getManager().getNetworkOperator();
322 | }
323 |
324 | @Kroll.method
325 | @Kroll.getProperty
326 | public String getNetworkOperatorName() {
327 | return getManager().getNetworkOperatorName();
328 | }
329 |
330 | @Kroll.method
331 | @Kroll.getProperty
332 | public int getNetworkType() {
333 | return getManager().getNetworkType();
334 | }
335 |
336 | @Kroll.method
337 | @Kroll.getProperty
338 | public int getPhoneType() {
339 | return getManager().getPhoneType();
340 | }
341 |
342 | @Kroll.method
343 | @Kroll.getProperty
344 | public String getSimCountryIso() {
345 | return getManager().getSimCountryIso();
346 | }
347 |
348 | @Kroll.method
349 | @Kroll.getProperty
350 | public String getSimOperator() {
351 | return getManager().getSimOperator();
352 | }
353 |
354 | @Kroll.method
355 | @Kroll.getProperty
356 | public String getSimOperatorName() {
357 | return getManager().getSimOperatorName();
358 | }
359 |
360 | @Kroll.method
361 | @Kroll.getProperty
362 | public String getSimSerialNumber() {
363 | return getManager().getSimSerialNumber();
364 | }
365 |
366 | @Kroll.method
367 | @Kroll.getProperty
368 | public int getSimState() {
369 | return getManager().getSimState();
370 | }
371 |
372 | @Kroll.method
373 | @Kroll.getProperty
374 | public String getSubscriberId() {
375 | return getManager().getSubscriberId();
376 | }
377 |
378 | @Kroll.method
379 | @Kroll.getProperty
380 | public String getVoiceMailAlphaTag() {
381 | return getManager().getVoiceMailAlphaTag();
382 | }
383 |
384 | @Kroll.method
385 | @Kroll.getProperty
386 | public String getVoiceMailNumber() {
387 | return getManager().getVoiceMailNumber();
388 | }
389 |
390 | @Kroll.method
391 | @Kroll.getProperty
392 | public boolean getHasCarrierPrivileges() {
393 | if (Build.VERSION.SDK_INT >= 22) {
394 | return getManager().hasCarrierPrivileges();
395 | } else {
396 | return false;
397 | }
398 | }
399 |
400 | @Kroll.method
401 | @Kroll.getProperty
402 | public boolean getHasIccCard() {
403 | return getManager().hasIccCard();
404 | }
405 |
406 | @Kroll.method
407 | public boolean iccCloseLogicalChannel(int channel) {
408 | return getManager().iccCloseLogicalChannel(channel);
409 | }
410 |
411 | @Kroll.method
412 | @Kroll.getProperty
413 | public boolean getIsNetworkRoaming() {
414 | return getManager().isNetworkRoaming();
415 | }
416 |
417 | @Kroll.method
418 | @Kroll.getProperty
419 | public boolean getIsSmsCapable() {
420 | return getManager().isSmsCapable();
421 | }
422 |
423 | @Kroll.method
424 | @Kroll.getProperty
425 | public boolean getIsVoiceCapable() {
426 | return getManager().isVoiceCapable();
427 | }
428 |
429 | @Kroll.method
430 | public String sendEnvelopeWithStatus(String content) {
431 | return getManager().sendEnvelopeWithStatus(content);
432 | }
433 |
434 | @Kroll.method
435 | public boolean setLine1NumberForDisplay(String alphaTag, String number) {
436 | return getManager().setLine1NumberForDisplay(alphaTag, number);
437 | }
438 |
439 | @Kroll.method
440 | public boolean setOperatorBrandOverride(String brand) {
441 | return getManager().setOperatorBrandOverride(brand);
442 | }
443 |
444 | @Kroll.method
445 | public boolean setPreferredNetworkTypeToGlobal() {
446 | return getManager().setPreferredNetworkTypeToGlobal();
447 | }
448 |
449 | @Kroll.setProperty
450 | public boolean setVoiceMailNumber(String alphaTag, String number) {
451 | return getManager().setVoiceMailNumber(alphaTag, number);
452 | }
453 |
454 | // Event Listeners
455 | @Override
456 | public void listenerAdded(String type, int count, KrollProxy proxy) {
457 | events |= getEventFlag(type);
458 | getManager().listen(getListener(), events);
459 | }
460 |
461 | @Override
462 | public void listenerRemoved(String type, int count, KrollProxy proxy) {
463 | events &= ~getEventFlag(type);
464 | getManager().listen(getListener(), events);
465 | }
466 |
467 | private int getEventFlag(String eventName) {
468 | if (eventName.equals(EVENT_CALL_FORWARDING_INDICATOR)){
469 | return PhoneStateListener.LISTEN_CALL_FORWARDING_INDICATOR;
470 | }
471 |
472 | if (eventName.equals(EVENT_CALL_STATE)){
473 | return PhoneStateListener.LISTEN_CALL_STATE;
474 | }
475 |
476 | if (eventName.equals(EVENT_CELL_INFO)){
477 | return PhoneStateListener.LISTEN_CELL_INFO;
478 | }
479 |
480 | if (eventName.equals(EVENT_CELL_LOCATION)){
481 | return PhoneStateListener.LISTEN_CELL_LOCATION;
482 | }
483 |
484 | if (eventName.equals(EVENT_DATA_ACTIVITY)){
485 | return PhoneStateListener.LISTEN_DATA_ACTIVITY;
486 | }
487 |
488 | if (eventName.equals(EVENT_DATA_CONNECTION_STATE)){
489 | return PhoneStateListener.LISTEN_DATA_CONNECTION_STATE;
490 | }
491 |
492 | if (eventName.equals(EVENT_MESSAGE_WAITING_INDICATOR)){
493 | return PhoneStateListener.LISTEN_MESSAGE_WAITING_INDICATOR;
494 | }
495 |
496 | if (eventName.equals(EVENT_SERVICE_STATE)){
497 | return PhoneStateListener.LISTEN_SERVICE_STATE;
498 | }
499 |
500 | if (eventName.equals(EVENT_SIGNAL_STRENGTHS)){
501 | return PhoneStateListener.LISTEN_SIGNAL_STRENGTHS;
502 | }
503 |
504 | return PhoneStateListener.LISTEN_NONE;
505 | }
506 |
507 | }
508 |
--------------------------------------------------------------------------------
/android/timodule.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/assets/README:
--------------------------------------------------------------------------------
1 | Place your assets like PNG files in this directory and they will be packaged
2 | with your module.
3 |
4 | All JavaScript files in the assets directory are IGNORED except if you create a
5 | file named "com.goyya.telephonymanager.js" in this directory in which case it will be
6 | wrapped by native code, compiled, and used as your module. This allows you to
7 | run pure JavaScript modules that are pre-compiled.
8 |
9 | Note: Mobile Web does not support this assets directory.
10 |
--------------------------------------------------------------------------------
/documentation/index.md:
--------------------------------------------------------------------------------
1 | # Titanium TelephonyManager [](http://gitt.io/component/com.goyya.telephonymanager)
2 | > Titanium Module for accessing the Android TelephonyManager
3 |
4 | ## Description
5 |
6 | This module exposes the Android [TelephonyManager](http://developer.android.com/reference/android/telephony/TelephonyManager.html) to Titanium.
7 |
8 | (If you are looking for something similar for iOS you should check out David Bankier's [CoreTelephony ](https://github.com/dbankier/CoreTelephony-for-Appcelerator-Titanium) module)
9 |
10 | ## Quick Start
11 |
12 | ### Installation
13 | Download the latest distribution ZIP-file and consult the [Titanium Documentation](http://docs.appcelerator.com/titanium/latest/#!/guide/Using_a_Module) on how install it, or simply use the [gitTio CLI](http://gitt.io/cli):
14 |
15 | `$ gittio install com.goyya.telephonymanager`
16 |
17 | ### Usage
18 |
19 | For the full API documentation please see [here](http://developer.android.com/reference/android/telephony/TelephonyManager.html)
20 |
21 | ```javascript
22 | var telephonymanager = require("com.goyya.telephonymanager");
23 |
24 | // these are just some infos you can get
25 | console.log('callState: ' + telephonymanager.callState);
26 | console.log('deviceId: ' + telephonymanager.deviceId);
27 | console.log('deviceSoftwareVersion: ' + telephonymanager.deviceSoftwareVersion);
28 | console.log('phoneNumber: ' + telephonymanager.line1Number);
29 | console.log('networkOperator: ' + telephonymanager.networkOperator);
30 | console.log('networkOperatorName: ' + telephonymanager.networkOperatorName);
31 | console.log('networkType: ' + telephonymanager.networkType);
32 | console.log('phoneType: ' + telephonymanager.phoneType);
33 | console.log('simOperator: ' + telephonymanager.simOperator);
34 | console.log('simOperatorName: ' + telephonymanager.simOperatorName);
35 | console.log('simSerialNumber: ' + telephonymanager.simSerialNumber);
36 | console.log('simState: ' + telephonymanager.simState);
37 | console.log('voiceMailNumber: ' + telephonymanager.voiceMailNumber);
38 | console.log('isNetworkRoaming: ' + telephonymanager.isNetworkRoaming);
39 | console.log('isSmsCapable: ' + telephonymanager.isSmsCapable);
40 | console.log('isVoiceCapable: ' + telephonymanager.isVoiceCapable);
41 | ```
42 |
43 | > NOTE: This module automatically adds the `READ_PHONE_STATE` permission to your manifest. If you are using methods of the TelephonyManager that are requiring any other permission, please add it manually to your tiapp.xml
44 |
45 | ## API Documentation
46 |
47 | ### Properties
48 |
49 | * `callState` _(Number)_
50 | * `CALL_STATE_RINGING`
51 | * `CALL_STATE_OFFHOOK`
52 | * `CALL_STATE_IDLE`
53 | * `dataActivity` _(Number)_
54 | * `DATA_ACTIVITY_NONE`
55 | * `DATA_ACTIVITY_IN`
56 | * `DATA_ACTIVITY_OUT`
57 | * `DATA_ACTIVITY_INOUT`
58 | * `DATA_ACTIVITY_DORMANT`
59 | * `dataState` _(Number)_
60 | * `DATA_DISCONNECTED`
61 | * `DATA_CONNECTING`
62 | * `DATA_CONNECTED`
63 | * `DATA_SUSPENDED`
64 | * `deviceId` _(String)_
65 | * `deviceSoftwareVersion` _(String)_
66 | * `groupIdLevel1` _(String)_
67 | * `line1Number` _(String)_
68 | * `mmsUAProfUrl` _(String)_
69 | * `mmsUserAgent` _(String)_
70 | * `networkCountryIso` _(String)_
71 | * `networkOperator` _(String)_
72 | * `networkOperatorName` _(String)_
73 | * `networkType` _(Number)_
74 | * `NETWORK_TYPE_1xRTT`
75 | * `NETWORK_TYPE_CDMA`
76 | * `NETWORK_TYPE_EDGE`
77 | * `NETWORK_TYPE_EHRPD`
78 | * `NETWORK_TYPE_EVDO_0`
79 | * `NETWORK_TYPE_EVDO_A`
80 | * `NETWORK_TYPE_EVDO_B`
81 | * `NETWORK_TYPE_GPRS`
82 | * `NETWORK_TYPE_HSDPA`
83 | * `NETWORK_TYPE_HSPA`
84 | * `NETWORK_TYPE_HSPAP`
85 | * `NETWORK_TYPE_HSUPA`
86 | * `NETWORK_TYPE_IDEN`
87 | * `NETWORK_TYPE_LTE`
88 | * `NETWORK_TYPE_UMTS`
89 | * `NETWORK_TYPE_UNKNOWN`
90 | * `phoneType` _(Number)_
91 | * `PHONE_TYPE_NONE`
92 | * `PHONE_TYPE_GSM`
93 | * `PHONE_TYPE_CDMA`
94 | * `PHONE_TYPE_SIP`
95 | * `simCountryIso` _(String)_
96 | * `simOperator` _(String)_
97 | * `simOperatorName` _(String)_
98 | * `simSerialNumber` _(String)_
99 | * `simState` _(Number)_
100 | * `SIM_STATE_UNKNOWN`
101 | * `SIM_STATE_ABSENT`
102 | * `SIM_STATE_PIN_REQUIRED`
103 | * `SIM_STATE_PUK_REQUIRED`
104 | * `SIM_STATE_NETWORK_LOCKED`
105 | * `SIM_STATE_READY`
106 | * `subscriberId` _(String)_
107 | * `voiceMailAlphaTag` _(String)_
108 | * `voiceMailNumber` _(String)_
109 | * `hasCarrierPrivileges` _(Boolean)_
110 | * `hasIccCard` _(Boolean)_
111 | * `isNetworkRoaming` _(Boolean)_
112 | * `isSmsCapable` _(Boolean)_
113 | * `isVoiceCapable` _(Boolean)_
114 |
115 |
116 | ### Events
117 |
118 | * `callForwardingIndicator`
119 | * `callState`
120 | * `cellInfo`
121 | * `cellLocation`
122 | * `dataActivity`
123 | * `dataConnectionState`
124 | * `messageWaitingIndicator`
125 | * `serviceState`
126 | * `signalStrengths`
127 |
--------------------------------------------------------------------------------
/example/app.js:
--------------------------------------------------------------------------------
1 | var telephonymanager = require('com.goyya.telephonymanager');
2 |
3 | telephonymanager.addEventListener('callState', function(e){
4 | console.log('callState changed to: ' + e.state
5 | + '\nincomingNumber: ' + e.incomingNumber);
6 | // e.state is on of:
7 | // - telephonymanager.CALL_STATE_RINGING
8 | // - telephonymanager.CALL_STATE_OFFHOOK
9 | // - telephonymanager.CALL_STATE_IDLE
10 | });
11 |
12 | console.log('callState: ' + telephonymanager.callState);
13 | console.log('dataActivity: ' + telephonymanager.dataActivity);
14 | console.log('dataState: ' + telephonymanager.dataState);
15 | console.log('deviceId: ' + telephonymanager.deviceId);
16 | console.log('deviceSoftwareVersion: ' + telephonymanager.deviceSoftwareVersion);
17 | console.log('groupIdLevel1: ' + telephonymanager.groupIdLevel1);
18 | console.log('line1Number: ' + telephonymanager.line1Number);
19 | console.log('mmsUAProfUrl: ' + telephonymanager.mmsUAProfUrl);
20 | console.log('mmsUserAgent: ' + telephonymanager.mmsUserAgent);
21 | console.log('networkCountryIso: ' + telephonymanager.networkCountryIso);
22 | console.log('networkOperator: ' + telephonymanager.networkOperator);
23 | console.log('networkOperatorName: ' + telephonymanager.networkOperatorName);
24 | console.log('networkType: ' + telephonymanager.networkType);
25 | console.log('phoneType: ' + telephonymanager.phoneType);
26 | console.log('simCountryIso: ' + telephonymanager.simCountryIso);
27 | console.log('simOperator: ' + telephonymanager.simOperator);
28 | console.log('simOperatorName: ' + telephonymanager.simOperatorName);
29 | console.log('simSerialNumber: ' + telephonymanager.simSerialNumber);
30 | console.log('simState: ' + telephonymanager.simState);
31 | console.log('subscriberId: ' + telephonymanager.subscriberId);
32 | console.log('voiceMailAlphaTag: ' + telephonymanager.voiceMailAlphaTag);
33 | console.log('voiceMailNumber: ' + telephonymanager.voiceMailNumber);
34 | console.log('hasCarrierPrivileges: ' + telephonymanager.hasCarrierPrivileges);
35 | console.log('hasIccCard: ' + telephonymanager.hasIccCard);
36 | console.log('isNetworkRoaming: ' + telephonymanager.isNetworkRoaming);
37 | console.log('isSmsCapable: ' + telephonymanager.isSmsCapable);
38 | console.log('isVoiceCapable: ' + telephonymanager.isVoiceCapable);
--------------------------------------------------------------------------------