Announcement

Collapse
No announcement yet.

4.13.2 Doesn't unregisterReceivers for Battery, Volume, and Headset. Crashes UE4 app launched a second time within another app's task

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

    4.13.2 Doesn't unregisterReceivers for Battery, Volume, and Headset. Crashes UE4 app launched a second time within another app's task

    EDIT4: The Battery, Volume, and Headset Receivers get registered on startup but never unregistered. I added some code to AndroidMisc that gets called on GEngineLoop.Exit() to unregister those receivers and now everything is fine.

    EDIT3: Looking at the logcat it appears there's a lot of stuff that isn't cleaned up on exit; I'm using RequestExit(false), which triggers the GEngineLoop.Exit(). There's a few comments in that function that say "such-n-such doesn't work on Android", but do those things need to happen?

    EDIT2: Seems it now crashes on ensure(IsInGameThread()) during LoadModule() called from GetPlatformChunkInstall(), but it does get past receiving the data at least!

    EDIT: Looks like the TransactionTooLargeException was thrown on a parcel size of ~866,000 bytes. That'll do it I guess. Will update again after stripping down unnecessary stuff from that data.

    Original post:
    We have an Ionic/Angular app (in launch mode singleTask) which launches our UE4.13.2 game (with launchMode singleTop) via a URL Scheme.

    Launching the app the first time works fine, the game shows the splash screen, loads up, and runs correctly; within the same task as the Ionic app, as desired.
    When we finish the game, we want to send some data back to the Ionic app, and we use another URL scheme for that, having the Ionic app's MainActivity save the data and access it later.

    To do this, the UE4 app calls LaunchURL and then finish() (via the AndroidJNI), the task switches back to the Ionic app and it loads and merges the data sent back from UE4. We often will want to launch the UE4 app again with that data after it's handled, and that launch is the same as the initial, the Ionic app just opens the URL with the data as a query parameter.

    The problem comes in when the data that gets loaded by the Ionic app is used to re-launch the UE4 app, it just stays on a black screen (no splash) and never proceeds. Trying to launch the UE4 app using a fresh set of data again works fine.

    My initial thought was there was something wrong with the data, but running the app in the editor and loading that same data string from disk works fine. (The only difference in the process there is instead of calling Android's GetIntent() we're doing a LoadFileToString()).

    I've created two little test apps in Android Studio to simulate the handoff between the real apps, and it works correctly with them, passing an incrementing integer as the data.

    So I don't know. I might be missing something really simple, or maybe Android has a limit to the length of the URL? The data is pretty long after the Ionic app processes it and sends it the second time, from 100,000 to over 300,000 characters. I don't know why it would cause this. The main weirdness is the lack of the splash screen... I've rearranged some things to have GameActivity just always do the splash, so it's not using the SplashActivity (which just passes the intent through to GameActivity anyway? why do we need that?).

    Some other details, pressing the switch task button closes the UE4 activity and returns to the Ionic activity. <more if I think of any>

    #SummonChrisBabcock!

    Thanks in advance for any insight into this issue!
    Last edited by jonathan.madden; 02-14-2018, 06:11 PM. Reason: Fixed I guess
Working...
X