Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

During the campaign period, a special offer will be sent over to users whose phone battery gets down to a low %. When the user is navigating throughout the app and his battery level is below x%, we will trigger a special offer and an In-App message will be sent to notify the user about this offer. The battery level will also check when the App is running in the user’s device background. The offer will be available to redeem only once per day or week. If the user hits the expected battery level more than once but does not redeem the offer, then the offer will continue showing to the user assuming their battery level fulfills the requirementsdisapear when the guest charges the phone.

2. Tech Requirements

  • Create a new ruleset User Attribute > Battery Level to be applied on SystemWide Offer.

  • The new ruleset will check the battery level according to the parameter inputted;

    • The User Attributes property, Battery Level will be checked when the user starts the app and then, every 2 minutes. This property will only be checked if at least one of the Systemwide Offers available has the Battery Level rule within its UserAttributes rules.

  • If the user’s battery level hits the parameter, an offer will be available on their Offers page, only App;

  • No latency between when the guest triggers the offer and when it appears in the App;

  • Display this offer on Kiosk, we need a development on our side and Acrelec also needs to have a development. So, the recommendation is go live only on App because the users receive a In-App notification and they can redeem the offer right-way in the App;

  • The offer will be available until the user battery becomes above the parameter;

  • To run the be able to run the battery level rule evaluation when the app is in background we're introducing @capacitor/background-runner package. This enables us to run JS scripts in the background for both Android and iOS:

    • We will schedule the background job successfully user first have to start the app.

    • When the app starts in the foreground, we persist all battery level rules from offers to be able to access this data later in the background. For user data we're accessing existing user data stored under RBI_USER key.

    • When the App enters the background, we schedule the background job. Currently, it's configured to run every 5 minutes, however due to platform level battery optimizations, it's not guaranteed that the script will always run (see the docs for more details). In the script we initially check if:

      • User is signed in

      • Battery level rules are stored

    • When these two conditions are met, we then evaluate the battery level rule with the current device battery level, in case when the battery level has changed enough to enter/leave the configured battery threshold, we will send a local notification when the conditions are met. When the guest taps the notification it opens the Offers Page in the App and the mParticle event will be sent from foreground. This would be safer in terms of duplicating events from foreground/background.

      • Risks:

        1. Platform level battery optimizations:

          1. There are no guarantees the background job will ever run, especially when the battery level is low;

          2. Need to take into consideration iOS and Android battery optimizations feature which they might be kill our background job.

            1. We should use threshold above 20%. For instance 30%, based on iOS platform usually starts their battery optimizations function in 20%.

...

#

Test Description

Test Steps

Expected Outcome

Test Result

Notes

1

The guest signs in and it is navigating in the app and his phone has the battery level > 30%

  1. User opens the App and navigating

  2. User’s device iOS or Android has more than 30% of battery

  1. The special offer doesn’t trigger in his Offers Page.

2

The guest signs and it is navigating in the app and his phone has the battery level <= 30%

  1. User opens the App and navigating

  2. User’s device iOS or Android has <= 30% of battery

  3. User gets the special offer

  1. Braze notifcation will be send (due to latency the user can get the message after some minutes).

  2. When the guest clicks on the message sent by Braze, the Offers Page is opened and the special offer will be available.

  3. User can go to Offers Page before the In-App message arrives and the special Offer will be available.

3

The guest signs and it is navigating in the app and his phone has the battery level <= 30%. The special offer will be available on the Offers Page, if the guests charge their phone the offer will disappear from the Offers Page.

  1. User opens the App and navigating

  2. User’s device iOS or Android has <= 30% of battery

  3. User gets the special offer via In-App message or directly access the Offers Page

  4. If the user charges his phone the offer will disappear from the Offers Page.

  1. Braze notification will be send (due to latency the user can get the message after some minutes).

  2. When the guest clicks on the message sent by Braze, the Offers Page is opened and the special offer will be available.

  3. User can go to Offers Page before the In-App message arrives and the special Offer will be available.

  4. Special offer will not be available if the user charges his phone.

3

The guest charges his phone to 100% of battery, after some hours, the guest has the battery level < = 30%. He opens the app and start to navigate, he got the special offer.

In the same day, the charge his phone to 100% of battery and opens the app, the special offer will be not triggered if the guest has redeemed the offer the first time it showed.

  1. User charge his battery to 100%

  2. Some hours later, user’s device iOS or Android has <= 30% of battery

  3. User opens the app and will get the special offer

  4. User charge again his battery to 100%

  5. Some hours later, user’s device iOS or Android has <= 30% of battery

  6. User opens the app and the special offer will not triggered twice if he has redeemed the offer the first time it showed

  1. User will get the special offer only once per day even user hits the battery level offer parameter more than once.

4

The guest opens the app, navigating and move to another app. BK app is running in the background and the battery level is still checking by our app each 5 minutes.