OneSignal, Inc.

OneSignal, Inc.

android_package property

On Android, the android_package property is the app ID. This can be verified by looking at the source code of the OneSignal Android Push Notification Plugin (archived).

Here, the android_package property is set to the value of the variable packageName (source, archived):

1deviceInfo.put("android_package", packageName);

This variable is set to the return value of the getPackageName() function on the appContext static property (source, archived):

1String packageName = appContext.getPackageName();

The static property appContext is an instance of the android.content.Context class (source 1 (archived) and 2 (archived)):

1import android.content.Context;
2
3// […]
4
5static Context appContext;

The getPackageName() function of that class returns the app ID (source, archived).

carrier property

The carrier property is the carrier of the SIM card inserted into the device. This can be verified by looking at the source code of the Android and iOS SDKs.

In the OneSignal Android Push Notification Plugin (archived), the carrier property is set to the return value of the function call osUtils.getCarrierName() (source, archived):

1deviceInfo.put("carrier", osUtils.getCarrierName());

The static osUtils variable is an instance of the TODO class (source 1 and 2):

1@NonNull private static OSUtils osUtils = new OSUtils();

The getCarrierName() function in that class uses the getNetworkOperatorName() function of the TelephonyManager class (documentation, archived) to get the carrier name (source, archived):

 1String getCarrierName() {
 2  try {
 3     TelephonyManager manager = (TelephonyManager) OneSignal.appContext.getSystemService(Context.TELEPHONY_SERVICE);
 4     // May throw even though it's not in noted in the Android docs.
 5     // Issue #427
 6     String carrierName = manager.getNetworkOperatorName();
 7     return "".equals(carrierName) ? null : carrierName;
 8  } catch(Throwable t) {
 9     t.printStackTrace();
10     return null;
11  }
12}

In the OneSignal iOS SDK (archived), the carrier property is set to the property carrier of the OSUserState class (source, archived):

1if (_carrier)
2    dataDic[@"carrier"] = _carrier;

This carrier property is set to the carrierName variable (source, archived):

1if (carrierName)
2    userState.carrier = carrierName;

The carrierName variable is set to the return value of [[instance valueForKey:@"subscriberCellularProvider"] valueForKey:@"carrierName"], where instance is an instance of CTTelephonyNetworkInfo (source, archived):

1let CTTelephonyNetworkInfoClass = NSClassFromString(@"CTTelephonyNetworkInfo");
2if (CTTelephonyNetworkInfoClass) {
3    id instance = [[CTTelephonyNetworkInfoClass alloc] init];
4    let carrierName = (NSString *)[[instance valueForKey:@"subscriberCellularProvider"] valueForKey:@"carrierName"];
5
6 // […]
7}

That function call returns the carrier name (documentation 1 (archived) and 2 (archived)).

ios_bundle property

On iOS, the ios_bundle property is the app ID. This can be verified by looking at the source code of the OneSignal iOS SDK (archived).

Here, the ios_bundle property is set to the property iOSBundle of the OSUserState class (source, archived):

1if (_iOSBundle)
2    dataDic[@"ios_bundle"] = _iOSBundle;

The iOSBundle property is set to the return value of the function call [[NSBundle mainBundle] bundleIdentifier] (source, archived):

1userState.iOSBundle = [[NSBundle mainBundle] bundleIdentifier];

[NSBundle mainBundle] is an accessor for getting the current app’s bundle (source, archived). And the bundleIdentifier function returns the app ID (source, archived).

sdk property

The sdk property is the SDK version. This can be verified by looking at the source code of the Android and iOS SDKs.

In the OneSignal Android Push Notification Plugin (archived), the sdk property is set to the static value VERSION (source, archived):

1deviceInfo.put("sdk", VERSION);

That value holds the SDK version (source, archived):

1private static final String VERSION = "040806";
2public static String getSdkVersionRaw() {
3  return VERSION;
4}

In the OneSignal iOS SDK (archived), the sdk property is set to the property sdk of the OSUserState class (source,archived):

1NSMutableDictionary *dataDic = [NSMutableDictionary dictionaryWithObjectsAndKeys:
2               // […]
3               _sdk, @"sdk",
4               nil];

This sdk property is set to the ONESIGNAL_VERSION constant (source, archived):

1userState.sdk = ONESIGNAL_VERSION;

The ONESIGNAL_VERSION constant holds the SDK version (source, archived):

1#define ONESIGNAL_VERSION                                                   @"031207"