Android App -> Unity SDK QR Scan Connectivity Issues Over Time

Hi all, I’ve been having a major issue with the Android App → Unity SDK QR scan functionality.

So, I imported MetaMask SDK into a project about two months ago. It worked perfectly, I could click connect, scan a QR code, a popup would appear on my phone, I’d approve the connection and a waterfall of successful console logs would appear in Unity. However as time passed, it would take longer and longer for the confirmation popup to appear on my phone, sometimes not ever showing up after minutes of sitting there waiting. But this would be inconsistent, I would sometimes scan the code and the confirmation popup would instantly appear. The behaviour has gotten worse and worse and I’m essentially entirely unable to connect my phone to Unity now.

I decided I would disable extraneous gameobjects on my scene and slowly re-enable them to isolate the issue. Disabling all extraneous gameobjects did not help. I decided I would go back to the demo scene that came with Unity and see what I am doing differently from that scene, but I had the same issue on that scene. I even started a brand new project and followed the instructions at [meta-mask-docs-url]/wallet/how-to/use-sdk/gaming/unity from start to finish and even with that project I am still not able to connect. My phone says Connecting to MetaMask… and the most recent Unity console log is MetaMask: Clients waiting to join.

I don’t understand what could possibly be causing the severity of this issue to be a function of time. And I don’t know how to resolve it. Does anyone have any ideas?

1 Like

Have you gotten help??

No, I just posted this an hour ago

Are you facing a similar issue? I’m leaning towards this being a MetaMask issue and not a “me” issue because of one big factor I learned since posting:

An Android app (apk) that I built from Unity was working this morning (spottily). Now I can’t get it to connect at all. Since the device and local code is consistent between those two occurrences, I don’t see how it could possibly be something on my end.

Update: I tested on an older Walmart Android (model LML211BL, Android v8.1.0) and an iPhone 13 mini I have and they both seem to work. I guess the issue is my Pixel 6a with GrapheneOS Android v13.

I still don’t understand why it was working flawlessly on the GrapheneOS Pixel at first, and won’t work at all now, but at least I can continue developing for now. I would still love to get this resolved so I can use my primary device for testing.

1 Like

Thanks to joshloveridge on the ConsenSys discord for helping me figure this out. I’m pretty embarrassed to admit this, but uninstalling and reinstalling the mobile app on my Pixel seemed to have solved the issue. It does seem like it could be some sort of cache leak or something, as the build up of cruft could potentially explain why it degraded over time instead of switching binarily from successes to failures. But I am able to continue working and am happy again :slight_smile:

3 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.