Skip to content

Commit

Permalink
Merge pull request #16 from susinda/master
Browse files Browse the repository at this point in the history
PhoneNumber is added to the deviceinfo payload
  • Loading branch information
harshanL authored Feb 27, 2017
2 parents 755434f + 37bc884 commit 1c15e2e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public void build() throws AndroidAgentException {
private void getInfo() throws AndroidAgentException {

TelephonyManager telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);

Location deviceLocation = locationService.getLastKnownLocation();
if (device == null) {
device = new Device();
Expand Down Expand Up @@ -225,6 +226,12 @@ private void getInfo() throws AndroidAgentException {
property.setValue(String.valueOf(deviceInfo.getNetworkOperatorName()));
deviceInfoProperties.add(property);

property = new Device.Property();
property.setName(Constants.Device.PHONE_NUMBER);
String mPhoneNumber = telephonyManager.getLine1Number();
property.setValue(mPhoneNumber);
deviceInfoProperties.add(property);

DeviceNetworkStatus deviceNetworkStatus = DeviceNetworkStatus.getInstance(context);
if (deviceNetworkStatus.isConnectedMobile()) {
telephonyManager.listen(deviceNetworkStatus, PhoneStateListener.LISTEN_SIGNAL_STRENGTHS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ private Device() {
public static final String PACKAGE = "PACKAGE";
public static final String PID = "PID";
public static final String SHARED_DIRTY = "SHARED_DIRTY";
public static final String PHONE_NUMBER = "PHONE_NUMBER";
}

// sqlite database related tables
Expand Down

0 comments on commit 1c15e2e

Please sign in to comment.