Android continues to find new ways to shock me with it's staggering limitations as a platform.
Last week I was pretty shocked to get more confirmation they are low key deprecating services for work manager.
Today it's that workers can only send max 10kb data segments for crash
Conversation
Replying to
Apps needing to keep open long-running connections/services have to use foreground services and starting those from the background requires a battery optimization exception. It has been clear for a while that the only way to do those kinds of things is combining both of those.
1
1
Doesn't mean that it's not supported but rather than it has to be very user visible, approved by the user and the user can choose to hide the foreground service notification or reduce it from LOW to MIN by toggling on making it collapsed/hidden. No way around that going forward.
1
Play Store theoretically forbids explicitly requesting a battery optimization exception from the user unless it's required (such as a P2P app) to force most apps to use FCM or JobScheduler/WorkManager. Users can grant it even if it's not requested, but that's not reasonable UX.
1
Due to Play Signing, you should have a separate app id for the build variant used on the Play Store, and can remove requesting a battery optimization exception if they force you. Per their policies, you should be allowed for P2P apps, but they aren't always enforced correctly.
1
You're inherently going to have a bad time if you try to do it any other way than the officially supported way. You can do your own push with no restrictions if you use the appropriate tools making it user authorized and user visible unless they choose to hide the notification.
FCM doesn't have any special magic beyond having a hard-wired battery optimization exception and not needing a foreground service. On GrapheneOS, where Play services isn't integrated into the OS and has no special privileges, FCM works perfectly fine via grapheneos.org/usage#sandboxe.

