- Home /
Launch main Unity activity in response to Android ACTION_BOOT_COMPLETED?
The company I work at is a Unity house, not a Native Android Java house.
A client has just last-minute-demanded that the (kiosk) app we're making for them launch itself every time the kiosk devices boot, since their kiosk management system can't simply specify a kiosk app to launch.
We've already done some successful hacking around e.g. android.permission.SYSTEM_ALERT_WINDOW and catching focus change events to do things like turn the device back on immediately and present our app on top of the lock screen if somebody taps the hard power button to turn the screen off, but my knowledge of deep-level Android OS voodoo doesn't extend much beyond that. So far, from research,
It looks like there is the ACTION_BOOT_COMPLETED intent which native apps can build explicit receiver classes for to run their own native code.
It sounds to be possible to make JAR plugins to define receiver classes for intents spelled out in... both the JAR manifest and the main Unity AndroidManifest? but...
I don't even know the proper way to launch a normal native activity from a receiver class callback, let alone figure out what the Unity main activity is called to invoke it from a plugin, short of (as advised in threads explored on other topics) invoking the plugin class over JNI from a running app to give it a handle to the main activity, which obviously wouldn't work in this case.
Is this a request that is going to be remotely doable on Unity? Can it be done short of grabbing the whole generated gradle project from the Temp folder after every build and applying the same hacks, then rebuilding the APKs from Android Studio?