UnityPlayerForActivityOrService implies it can be used from a service, as UnityPlayer was capable in the past. However, there are several calls in UnityPlayerForActivityOrService that assume that passed context is bound to Activity, such as,
Which fails if the UnityPlayerForActivityOrService is instantiated from a service.
How do I instantiate a UnityPlayer that is bound to a service (long-running and used as an overlay view via WindowManager) instead of an activity (which can be terminated by OS at any point if minmized).
Unity doesn’t officially support instantiating from Service, the only case where it was somewhat supported is WallpaperService, for which we have automatic coverage which ensures it works.
I am not exactly sure about your case, could submit a bug with repro project attached, so we can investigate.