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

SDK doesn't trigger didReportBatteryLevel after it's connected to BT reader #262

Closed
TatsuUkraine opened this issue Oct 20, 2023 · 7 comments · Fixed by #269
Closed

SDK doesn't trigger didReportBatteryLevel after it's connected to BT reader #262

TatsuUkraine opened this issue Oct 20, 2023 · 7 comments · Fixed by #269

Comments

@TatsuUkraine
Copy link

TatsuUkraine commented Oct 20, 2023

Summary

-reader:didReportBatteryLevel:status:isCharging: not triggering as soon as SDK established connection to M2 readers.

iOS version

16.6

SDK version

v3.1.0

Other information

@bric-stripe
Copy link
Collaborator

Hi, I just gave this a quick try and wasn't able to reproduce. To set some expectations:

  • the SDK currently polls every 10 minutes to get the charging and battery level data from the reader. So at best you should only expect to see the delegate method called once every 10 minutes the app is in the foreground
    • but when the host application goes to background and then comes back to the foreground the SDK should attempt to update the battery info
  • if the reader is busy waiting for payment in collectPaymentMethod (or refund or setup intent) it will block the battery level polling from happening
  • the SDK will only call the delegate method if the battery level or isCharging has changed from its previous values.

so quickest way to test that the delegate is working is to:

  1. connect while having the reader plugged in
  2. unplug the reader
  3. background and foreground the host application to force it to attempt to update the info

at that point, assuming the reader wasn't collecting payment, it should report that the isCharging state changed from true to false.

can you confirm you're not seeing that though?

another thing to confirm is that the ReaderDelegate hasn't been deallocated. The SDK has a weak reference so if your application code doesn't retain a strong reference it could be that its being released. Easiest way to check on that is: are any other delegate methods being called successfully? The didRequestReaderInput is probably the easiest to check on by starting a collectPaymentMethod and confirm you see the request to swipe/insert/tap show up through there. If that's also not firing the released delegate is likely the cause.

if only not seeing the battery method being called can you share a reader serial number and rough time of when you expected to see a change be reported? we can try to look through some logs to see if anything stands out.

also, are you seeing this as a regression? Were you previously successfully getting callbacks in < 3.1?

@TatsuUkraine
Copy link
Author

Easiest way to check on that is: are any other delegate methods being called successfully?

yes, I'm getting method call for low-battery warning, so delegate it seems working and attached in a proper way. Also all delegate methods related to software update/install working too

also, are you seeing this as a regression? Were you previously successfully getting callbacks in < 3.1?

yes, tested with v2.x, delegate is invoked as soon as connection is established. Also, (I don't know if it makes any difference) In Android SDK battery level callback also invoked as soon as app connected to BT device on both v2 and v3

@TatsuUkraine
Copy link
Author

TatsuUkraine commented Oct 20, 2023

but when the host application goes to background and then comes back to the foreground the SDK should attempt to update the battery info

@bric-stripe btw, this one actually makes delegate method to invoke. So the delegate works fine, it just doesn't trigger after app is established connection to the BT reader, as it was in v2

@TatsuUkraine
Copy link
Author

TatsuUkraine commented Oct 20, 2023

also, I can reproduce this with both real and simulated BT device. Only one difference there is that "background and then comes back to the foreground" trick doesn't work with simulated one, I can assume because, unlike real device, the battery info on the simulated device doesn't change

@TatsuUkraine
Copy link
Author

TatsuUkraine commented Oct 20, 2023

sorry, probably I didn't describe the problem clear enough) so the delegate it seems working (overall), at least moving the app into the background and back to the foreground forces this delegate method to be triggered (if battery info changed in between).

The problem there is that this delegate method doesn't trigger as soon as you establish the connection to the BT device. Like Android SDK does, or like it was in v2

@stripe stripe deleted a comment Oct 20, 2023
@bric-stripe
Copy link
Collaborator

The problem there is that this delegate method doesn't trigger as soon as you establish the connection to the BT device

ah, thanks for clarifying. We'll look in to that 👍

@bric-stripe
Copy link
Collaborator

this should be fixed now in 3.2, please re-open if still seeing issues though

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

Successfully merging a pull request may close this issue.

2 participants