File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
OneSignalSDK/onesignal/src/main/java/com/onesignal Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 41
41
import android .os .Build ;
42
42
import android .os .Bundle ;
43
43
import android .text .TextUtils ;
44
+ import android .text .format .Time ;
44
45
import android .util .Log ;
45
46
46
47
import androidx .annotation .NonNull ;
47
48
import androidx .annotation .Nullable ;
49
+ import androidx .annotation .RequiresApi ;
48
50
import androidx .annotation .WorkerThread ;
49
51
import androidx .core .app .NotificationCompat ;
50
52
@@ -1308,6 +1310,14 @@ private static int getTimeZoneOffset() {
1308
1310
return offset / 1000 ;
1309
1311
}
1310
1312
1313
+ private static String getTimeZoneId () {
1314
+ if (android .os .Build .VERSION .SDK_INT >= android .os .Build .VERSION_CODES .O ) {
1315
+ return TimeZone .getDefault ().toZoneId ().getId ();
1316
+ } else {
1317
+ return Time .getCurrentTimezone ();
1318
+ }
1319
+ }
1320
+
1311
1321
private static void registerUser () {
1312
1322
logger .debug (
1313
1323
"registerUser:" +
@@ -1349,6 +1359,7 @@ private static void registerUserTask() throws JSONException {
1349
1359
}
1350
1360
deviceInfo .put ("device_os" , Build .VERSION .RELEASE );
1351
1361
deviceInfo .put ("timezone" , getTimeZoneOffset ());
1362
+ deviceInfo .put ("timezone_id" , getTimeZoneId ());
1352
1363
deviceInfo .put ("language" , OSUtils .getCorrectedLanguage ());
1353
1364
deviceInfo .put ("sdk" , VERSION );
1354
1365
deviceInfo .put ("sdk_type" , sdkType );
You can’t perform that action at this time.
0 commit comments