reignstudios / Reign-Unity-Plugin

Unity 4.x version of the Reign plugins.
Other
36 stars 11 forks source link

Crashing when receiving intent #3

Open GuyCorbett opened 7 years ago

GuyCorbett commented 7 years ago

Thanks for this plugin, I recently downloaded the Android version from the Unity Asset store and it's been really useful! However, I am encountering an issue.

I set up my app so that on Android it would automatically be used to open a custom file type I created when the user selects any such file from a browser app etc. This worked all fine before I integrated this plugin into the project. However, now that I have the plugin, it works only if the app isn't already running when I try to open a file. If it is running my app immediately crashes, even if I remove all code which processes the file.

In order to do this I added some intent filters into my AndroidManifest. Before I downloaded this plugin I had the intent filters inside the UnityPlayerActivity. This plugin replaces that with the ReignUnityActivity which is where I added them instead.

Is there anything you can suggest?

zezba9000 commented 7 years ago

Unless I'm misunderstanding, its possible something with onActivityResult.

REF: Link

GuyCorbett commented 7 years ago

Hey,

Thanks for the reply and sorry for the delay. I think I may have explained poorly. I am not sending an intent from my application so onActivityResult should never be called. What's happening is that I open my app, I minimise it by pressing the android home button, I open a file browser app, attempt to open one of my custom files, Android correctly switches back to my app but it immediately crashes.

In this case I think it would be onNewIntent that gets called, not onActivityResult, however I have not got as far as implementing that so it should just effectively ignore the intent. Is it possible that some of your plugin code implements onNewIntent and that is crashing because it's trying to read my file?

Incidentally, to try to fix this I removed the plugin from my app and downloaded the Unity 5 targeted version from Git instead. However I can't get this working at all because I can't generate the Android manifest. Your online docs explain how to do it but they refer to a menu option which doesn't seem to exist; Edit->Reign->Tools->Merge Reign Android Manifest.

zezba9000 commented 7 years ago

I don't really have much time to look into this. I just pushed up some missing draft docs to the Unity5 version if you want to take a stab at that with Android Studio: https://github.com/reignstudios/Reign-Unity-Plugin5/tree/master/DOCS

If so, look at the "general" doc.