Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Timezone Offset Missing in OneSignal Android SDK 5+ #1968

Open
1 task done
c0nnor263wwl opened this issue Jan 22, 2024 · 3 comments
Open
1 task done

[Bug]: Timezone Offset Missing in OneSignal Android SDK 5+ #1968

c0nnor263wwl opened this issue Jan 22, 2024 · 3 comments

Comments

@c0nnor263wwl
Copy link

c0nnor263wwl commented Jan 22, 2024

What happened?

After updating to OneSignal Android SDK version 5.10.0 (possibly related to Unity SDK as well), I noticed a significant change in the JSON payload when initializing the application. Compared to the previous version (4.8.7), the newer version's JSON payload lacks the timezone field, which used to provide the timezone offset in CVS export files. This is crucial for our application's functionality, as we rely on this data for various features.

My thoughts:
With the transition to OneSignal SDK version 5.0.0 and above, there has been a noticeable change in the API, particularly with the 'Add Device' method. Previously, this method was integral to old OneSignal versions as it accepted 'timezone' as one of its arguments, providing valuable data for our application's functionality.

However, in the newer versions, the 'Add Device' method has been deprecated. As a consequence, OneSignal change it to using the 'Create User' method. Upon examination of API page, it's clear that 'Create User' doesn’t accept any 'timezone' information. Instead, it only takes 'timezone_id' along with other parameters that are useful for determining the user's location.

This shift in the API's functionality presents a significant challenge for us. The absence of the 'timezone' parameter in the new 'Create User' method directly affects our ability to obtain the timezone offset in our CSV export files. These files are crucial for sending targeted notifications to our users. With the latest API changes, we've noticed that the timezone information in these exports is now missing, leaving the timezone field empty. This limitation hinders our capacity to deliver notifications at the most appropriate times for each user, based on their local time zones.

Steps to reproduce?

- Integrate the OneSignal Android SDK version 5+
- Initialize the OneSignal SDK in application class
- Setup log level to LogLevel.VERBOSE
- Run application 
- Observe and log the JSON payload received from the OneSignal SDK during the initialization


Repeat the same steps with an earlier version of the OneSignal SDK (like 4.8.7) where the issue was not present.

What did you expect to happen?

The JSON payload should include both timezone_id and timezone

OneSignal Android SDK version

Release 5.10.0

Android version

13, 12, 11, 10, 9, 8, 7.1, 7.0

Specific Android models

No response

Relevant log output

OneSignal 5+:

{
  "subscriptions": [
    ...
  ],
  "properties": {
    "timezone_id": "Europe/Kiev",
    "language": "en"
  },
  ...
}



OneSignal 4.8.7:

{
  …
  "timezone": 7200,
  "timezone_id": "Europe/Kiev",
  "language": "en",
  …
}

Code of Conduct

  • I agree to follow this project's Code of Conduct
@c0nnor263wwl c0nnor263wwl changed the title [Bug]: [Bug]: Timezone Offset Missing in OneSignal Android SDK 5+ Jan 22, 2024
@jennantilla
Copy link
Contributor

Hi @c0nnor263wwl thank you so much for your thoughtful report!

How were you previously using the 'timezone' parameter to send targeted notifications to your users? Were you creating a segment based on timezone offset? Or something else?

It sounds like your ultimate objective is to deliver notifications at the most appropriate times for each user, based on their local time zone. We do currently support setting custom notification delivery time per user timezone. It can be found at the bottom of the push notification form in the dashboard or by using the Create notification API endpoint with the delayed_option and delivery_time_of_day parameters.

If you would like to expand on your use case a bit more, I'd be happy to discuss further solutions!

@c0nnor263wwl
Copy link
Author

Thanks for the quick response, @jennantilla!

At the moment we are using our own web solution, which is based on working with the OneSignal API. For its correct operation, we carry out periodic synchronization between OneSignal and our solution. All this is tied to one thing - Export Subscriptions CSV

Before version 5+ of OneSignal, when exporting Subscriptions CSV, we correctly received all the parameters, including the timezone we needed so much, because the OneSignal Android SDK itself, up to version 5+, calculated and explicitly sent it in the body of the request to the OneSignal API. Based on timezone, we independently calculated within our system when and how many notifications should be sent to a specific user, with a specific time zone

If we use versions 5+ and higher of OneSignal, then our Export Subscriptions CSV will be deprived of the parameter we need, and accordingly the entire system stops working as expected. We still don’t understand why it was necessary to move away from this parameter and completely replace the Add Device method with Create User, which lacks the timezone parameter

Is it possible to correct this situation by adding the missing parameter in new versions of the SDK, given that in the code sources themselves there is a class com.onesignal.common.TimeUtils responsible for calculating this parameter, but which is not used?

What alternatives can you suggest in the absence of the timezone parameter? We would not like to tear our product into separate work of two parts with 4+ and 5+ versions because of one parameter

@jkasten2
Copy link
Member

@c0nnor263wwl The timezone is no longer being set in place of timezone_id in 5.x.x. This was done as timezone isn't enough information to accurately calculate time, as it off by 1 hour twice a year for some time zones.

timezone_id is set by both 4.x.x and 5.x.x Android SDKs, so you can use this reliably for all your users / devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants