Billing when app is in the background/asleep
We are building an AppleVisionPro app that uses Normcore. We notice that our Normcore billing hours are much higher than we expected. We think it may be because when the user switches our app to the background, that Normcore still accumulates time. If this is possible - any suggestions on how to prevent billing when the app is in the background?
3 Replies
Hi @DC. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Normcore billing is based on "room hours," which are defined as the total number of hours that a room server is running and clients are connected. The room server automatically shuts down 30 seconds after the last client disconnects, and billing stops at that point. If your app remains connected to the room while in the background or asleep, Normcore will continue to accumulate room hours and bill accordingly. This could explain the higher-than-expected billing if your app does not disconnect when backgrounded or put to sleep.
To prevent unnecessary billing, you should ensure that your app disconnects from the Normcore room when it goes into the background or is suspended. In Unity, you can use the OnApplicationPause or OnApplicationFocus callbacks to detect when your app is backgrounded and programmatically disconnect from the room. When the user returns, you can reconnect as needed.
There is no explicit mention in the Normcore documentation of automatic disconnection on backgrounding, so this logic should be implemented in your app to control billing and resource usage. If you need more detailed guidance on implementing this in Unity, let me know!
Normcore Pricing ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
Normcore Pricing ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
<@1259730396577529917> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Normcore only measures room hours on the backend. If folks are staying connected while the app is in the background, use Apple’s events to disconnect when the app is backgrounded
If they’re disconnected, then they’re not creating any billable time