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]: addTrigger does not display In-App-Message under android 13 #1690

Closed
1 task done
zfanta opened this issue Nov 18, 2022 · 2 comments
Closed
1 task done

[Bug]: addTrigger does not display In-App-Message under android 13 #1690

zfanta opened this issue Nov 18, 2022 · 2 comments

Comments

@zfanta
Copy link

zfanta commented Nov 18, 2022

What happened?

In react-native, calling OneSignal.addTrigger does not display IAM under android 13. Sending test IAM in web dashboard works properly.

Steps to reproduce?

1. Use [email protected](com.onesignal:OneSignal:4.8.2)
1. Call `OneSignal.addTrigger` in react-native under android 13

What did you expect to happen?

Under android 13 device should diplay IAM.

com.onesignal.UserStateSynchronizer#doCreateOrNewSession calls https://api.onesignal.com/players and responses between android 12 and android 13 are different.

Android 12 request

accept: application/vnd.onesignal.v1+json
content-type: application/json; charset=UTF-8
sdk-version: onesignal/android/040802

{
  "app_id": "be7d6e82-c901-405e-9f7c-9015fdf11266",
  "device_os": "12",
  "timezone": 32400,
  "timezone_id": "Asia/Seoul",
  "language": "ko",
  "sdk": "040802",
  "sdk_type": "react",
  "android_package": "com.jdjeon",
  "device_model": "SM-A325N",
  "game_version": 14,
  "net_type": 0,
  "rooted": false,
  "identifier": "dqT_6Wt0QduYrIXgoGKhwy:APA91bFcKo6vRFLdMGFYjk8YOsVK-hK4-Y1zeT1hBd6uIOoMyJD9PmVTIerGI4cxo_GQ0e24VEll9ohgQ8Cvg93Mb6kHpEEATh1891AS-shcThGYwimq-mHeOC_gjOlSGeG5aQhDuwSa",
  "device_type": 1
}

Android 12 response

{
  "success": true,
  "id": "130c416f-1531-482b-b1f5-e00607396bd1"
}

Android 13 request

accept: application/vnd.onesignal.v1+json
content-type: application/json; charset=UTF-8
sdk-version: onesignal/android/040802

{
  "app_id": "be7d6e82-c901-405e-9f7c-9015fdf11266",
  "device_os": "13",
  "timezone": 0,
  "timezone_id": "GMT",
  "language": "en",
  "sdk": "040802",
  "sdk_type": "react",
  "android_package": "com.jdjeon",
  "device_model": "sdk_gphone64_x86_64",
  "game_version": 14,
  "net_type": 0,
  "carrier": "T-Mobile",
  "rooted": false,
  "identifier": "cdbeLOhtTu6DIi8l1SKEGb:APA91bGItjvHpnfeG9mR0kUN-7JFD2p4HyeEQpKEOeg_N4tAWTCZgvVaxaeJC1eEDpCJHp29lSN736q6TVfuWUfGcrO_fujkZTuoIFsy62HHuSx1H314tuCt-6Mo777-W65VSH7Fkf1s",
  "device_type": 1,
  "notification_types": 0
}

Android 13 response

{
  "success": true,
  "id": "cfbf305b-e2ad-46ce-ac4f-ce90d28905cd",
  "in_app_messages": [
    {
      "id": "c8208f34-a556-48c0-81e4-ca5235f7f595",
      "triggers": [
        [
          {
            "id": "64011c0f-64c4-4b99-a8cc-8febfad89b2f",
            "kind": "custom",
            "property": "prompt_notification",
            "operator": "equal",
            "value": "true"
          }
        ]
      ],
      "variants": {
        "all": {
          "default": "cdd9f123-05a7-4b86-80d4-6777fe630b6f"
        }
      },
      "end_time": null,
      "redisplay": {
        "limit": 2147483647,
        "delay": 0
      }
    }
  ]
}

Android 12 response does not have in_app_messages property, so this code is not executed.

if (jsonResponse.has(IN_APP_MESSAGES_JSON_KEY))
OneSignal.getInAppMessageController().receivedInAppMessageJson(jsonResponse.getJSONArray(IN_APP_MESSAGES_JSON_KEY));

If above code is not executed, com.onesignal.OSInAppMessageController#messages has no message and com.onesignal.OSInAppMessageController#evaluateInAppMessages triggered by OneSignal.addTrigger in react-native does nothing.

If requset contains "device_os": "13" and "notification_types": 0, response have the in_app_messages attribute.

OneSignal Android SDK version

Release 4.8.2

Android version

12

Specific Android models

* Samsung SM-A325N

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@jkasten2
Copy link
Member

jkasten2 commented Dec 1, 2022

@zfanta Thanks for reporting with all these details. Just to confirm the issue, Android 13 works fine to display the Android 12 does not?

If that is the case that is expected, in Android 12 and lower notifications are enabled by default, there is no need to prompt them. This is why the you don't see the In-App Message in the in_app_messages payload.

  • The only exception to this is if manually turn off notifications at the operation system for your app this will work for any version of Android.

@jennantilla
Copy link
Contributor

Closing issue due to no response. Please @ mention me if we need to revisit this issue.

We have an updated major release available for our Android SDK with many improvements and enhancements! Please refer to the migration guide for more information on upgrading.

Thanks!

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

No branches or pull requests

3 participants