Skip to content

Conversation

@quanghuynb123456789
Copy link

Add WakeUp and AutoStart Features to MobileNativeCode Plugin

Description

This PR introduces two new features to the MobileNativeCode plugin for Unreal Engine on Android.

WakeUp

  • Prevents the Android device from entering Doze Mode
  • Keeps Wi-Fi alive even during screen-off or idle state
  • Ideal for real-time apps like VR multiplayer or persistent networking
  • Restrict:
    • Currently limited to run only while the app is active - this is an intentional design choice
    • To make it work even when the app is closed, simply remove the AppLifecycleObserver restriction, and let the background service run independently

AutoStart

  • Automatically launches the application right after device boot
  • Implements BroadcastReceiver to detect BOOT_COMPLETED
  • Starts a custom background Service to trigger app launch
  • Verified functionality on Meta Quest (Android VR device)

Testing

  • Tested on Meta Quest 2
  • Both features function reliably across multiple reboots and idle/wake cycles
  • No noticeable performance or battery issues during usage

Changes

  • Added new Java classes: WakeUpHelper.java, AutoStartReceiver.java, BootService.java
  • Modified plugin AndroidManifest.xml to declare permissions and services
  • Exposed native methods to Unreal via JNI for enabling these features

Notes

  • AutoStart requires RECEIVE_BOOT_COMPLETED and proper system permission
  • WakeLock is used carefully to avoid battery abuse; it's released appropriately
  • No changes were made to existing plugin logic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant