-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed compilation and potential crashes on Android M when the Fragmen…
…t was recreated using the default ctor
- Loading branch information
Showing
1 changed file
with
11 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92e1a33
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi! When the fragment is automatically recreated? If this occurs, would be better to save instance state and then restore it, to request again permissions when it gets recreated?
92e1a33
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi!
For example, when you pause the app when showing the fragment, and then resume it.
It would be better to save the state if possible - not sure if it's possible to handle with the permission request/callback though.
Your suggestions/PRs are welcome!
92e1a33
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your fast response. I've made this sightly modified version of your permission manager:
As you can see, I'm not using IPermissionRequestResult, but a simple string for the callback, so it can be saved in the Bundle object.
RequestPermission method in C# is like this:
And in the GameObject with name callbackGameObjectName, you must have two callback methods:
In order to use
UnityPlayer.UnitySendMessage
you have to include Unity'sclasses.jar
file in your Android module libs folder. You can find it inC:\Program Files\Unity\Editor\Data
(/Applications/Unity
on Mac) in a subfolder calledPlaybackEngines/AndroidPlayer/Variations/mono
oril2cpp/Development
orRelease/Classes/
. In your module build.grade file, you have include using this:By using "provided", classes.jar will not be added to the aar file, so you will avoid redundancy, and it's not needed.
What do you think about it?