Code Monkey home page Code Monkey logo

unityandroidpermissions's People

Contributors

bryksin avatar fadookie avatar over17 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unityandroidpermissions's Issues

Doesn't work on Android 8 (O)

08-28 11:45:43.803: E/Unity(12110): AndroidJavaException: java.lang.IllegalStateException: Fragment null must be a public static class to be properly recreated from instance state.
08-28 11:45:43.803: E/Unity(12110): java.lang.IllegalStateException: Fragment null must be a public static class to be properly recreated from instance state.
08-28 11:45:43.803: E/Unity(12110): at android.app.BackStackRecord.doAddOp(BackStackRecord.java:429)
08-28 11:45:43.803: E/Unity(12110): at android.app.BackStackRecord.add(BackStackRecord.java:414)
08-28 11:45:43.803: E/Unity(12110): at com.unity3d.player.UnityAndroidPermissions.RequestPermissionAsync(UnityAndroidPermissions.java:66)
08-28 11:45:43.803: E/Unity(12110): at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
08-28 11:45:43.803: E/Unity(12110): at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
08-28 11:45:43.803: E/Unity(12110): at com.unity3d.player.UnityPlayer$c$1.handleMessage(Unknown Source:151)
08-28 11:45:43.803: E/Unity(12110): at android.os.Handler.dispatchMessage(Handler.java:101)
08-28 11:45:43.803: E/Unity(12110): at android.os.Looper.loop(Looper.java:164)
08-28 11:45:43.803: E/Unity(12110): at com.unity3d.player.UnityPlayer$c.run(Unknown Source:20)
08-28 11:45:43.803: E/Unity(12110): at UnityEngine.AndroidJNISafe.CheckException () [0x0008c] in C:\unity\trunk\Runtime\Export\AndroidJNISafe.cs:24
08-28 11:45:43.803: E/Unity(12110): at UnityEngine.AndroidJNISafe.CallVoidMethod (IntPtr

Tried on Pixel XL.

Android UI Dialog Doesn't Show Up

Not sure if this is because of Unity or Oculus Quest, The problem is, the android UI dialog doesn't show up. The Unity version I'm using is 2019.4.11.

What I have done is:

  1. Copied and pasted the unityandroidpermissions.aar file under Assets/Plugins/Android (tried both the downloaded version and the one I built by myself);
  2. Changed the path of the .aar file to Assets/Plugins/Android/libs, as this is from the manual doc of Unity 2019.4;
  3. Set "unityplayer.SkipPermissionsDialog" to true in the "AndroidManifest.xml" file (otherwise it'd conflict with the .aar file);
  4. Attached the AndroidPermissionsUsageExample.cs to an empty GameObject in my scene;
  5. Built to the Android device (I'm using Oculus Quest).

Is there any step I did wrong or I missed some configuration?

Callbacks not on Main Thread issue

I have integrated your plugin and it's working great - thanks!

But I have one problem/suggestion: make the callbacks run on main thread.

I was having a lot of problems until I found out the callbacks weren't on the main thread.

I had to turn on a flag on the callback and then check for the flag on the next Update. No big deal, but it would be better if the callback was already on the main thread, or at least make it clear for the developer that the callbacks are not on the main thread.

Best

Denied Permission

I am using unity 5.3.4 and am trying to implement this to fix the OREO black screen issue.

I created a blank scene and added the library and implemented the sample code.

I am checking to see if the storage permission is granted, if not i immediately call the grant button press function (so i don't have to create a ui.. for testing only) however the callback comes back as failed.

Am i missing something or doing something wrong?

ANRs And crashes

capture

See ANRs Report of my game after using this plugin. ANRs is high.please give me solution.

MainThread issue

@Over17
I'm calling an event in the callback of "AndroidPermissionsManager.RequestPermission" and the attached method of the event listener calls "Destroy(myGameObject)".

The "Destroy()" line causes a UnityException, that this can only be called from the main thread. I'm not using other threads anywhere, so I was wondering if the callback is automatically executed on another thread.

OnDenyAndNeverAskAgain

Can you please add the event for when a player chooses the option to deny the prompt and never show again.

Support for the Android M "Don't show again" checkbox

Would be great to be able toprocess the case when in Andoird M+ uses ticked the "Don't show again" checkbox at the permission request popup.

Looks like ActivityCompat.shouldShowRequestPermissionRationale can help here.

Not working for development builds

I have implemented this plugin in my app and it works as expected.

However, if I make a development build (from Unity build settings) of the same app, it will always automatically return Denied. The permission window does not appear at all.

Any ideas how to resolve this issue?

Merge Manifest.xml instead override it

Hi!

If you use the Manifest.xml as you suggest, then this Manifest.xml will override the Unity Manifest.xml. It would be better to merge it instead. To do it, just add "unityplayer.SkipPermissionsDialog"="true" metadata tag to the Manifest.xml in src folder, so it will be inside aar, and it will be merged and such tag will appear on the Manifest.mxl generated by Unity.

Thanks for this great plugin!

No permission dialog

I using very simple script to request permission, but I always getting permissionDenied callback. Also IsPermissionGranted always return false, even when I set permission in application settings.
App built with 26 API, and I have installed firebase messaging plugin, that uses custom activity. Tested with meizu U10, maybe problem with flyme.

What I doing wrong?

private static string[] PERMISSIONS =
    {
        "INTERNET",
        "ACCESS_NETWORK_STATE",
        "READ_PHONE_STATE",
        "ACCESS_WIFI_STATE",
        "ACCESS_FINE_LOCATION",
        "ACCESS_COARSE_LOCATION",
    };

    private IEnumerator Start()
    {
#if UNITY_ANDROID //&& !UNITY_EDITOR
        foreach (string p in PERMISSIONS)
        {
            if (!AndroidPermissionsManager.IsPermissionGranted(p))
            {
                Debug.Log("No permission: '" + p + "'\nRequest for permission. " + Time.frameCount);
                bool granted = false;
                bool gotCallback = false;
                AndroidPermissionsManager.RequestPermission(new string[] { p }, new AndroidPermissionCallback(
                    grantedPermission =>
                    {
                        gotCallback = true;
                        granted = true;
                    },
                    deniedPermission =>
                    {
                        gotCallback = true;
                        granted = false;
                    }
                    ));

                while (gotCallback == false)
                    yield return null;
                if (granted)
                {
                    Debug.Log("Permission '" + p + "' is granted. " + Time.frameCount);
                }
                else
                {
                    Debug.Log("Permission '" + p + "' is denied! " + Time.frameCount);
                }
            }
        }
#endif
        
    }

Not working as expected

Hi, thanks for the great plugin and hard work, but so far, I have been unable to get it working properly.
Maybe I am just completely misunderstanding the stuff and kind of expecting something which the plugin doesn't provide, in this case, I do apologize in advance.

Now, to the problem. I am using or trying to use
void RequestPermission() for a android.permission.WRITE_EXTERNAL_STORAGE.
If I understand correctly, this method, when invoked, should request the given permission from the user by showing some system dialog and calling appropriate callback afterwards. But when I call this method, no system UI is shown and OnPermissionDenied() is immediately called indicating that permission has been denied.

Is this the expected behavior? Am I doing something wrong or did I understand the docs the wrong way?

com.unity3d.plugin.UnityAndroidPermissions$IPermissionRequestResult2 ClassNotFoundException

Hello,

I tried to use this, but I get this error:

AndroidJavaException: java.lang.ClassNotFoundException: com.unity3d.plugin.UnityAndroidPermissions$IPermissionRequestResult2
10-31 14:53:40.712  7396  7411 E Unity   : java.lang.ClassNotFoundException: com.unity3d.plugin.UnityAndroidPermissions$IPermissionRequestResult2
10-31 14:53:40.712  7396  7411 E Unity   :      at java.lang.Class.classForName(Native Method)
10-31 14:53:40.712  7396  7411 E Unity   :      at java.lang.Class.forName(Class.java:400)
10-31 14:53:40.712  7396  7411 E Unity   :      at java.lang.Class.forName(Class.java:326)
10-31 14:53:40.712  7396  7411 E Unity   :      at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
10-31 14:53:40.712  7396  7411 E Unity   :      at com.unity3d.player.UnityPlayer.c(Unknown Source)
10-31 14:53:40.712  7396  7411 E Unity   :      at com.unity3d.player.UnityPlayer$e$2.queueIdle(Unknown Source)
10-31 14:53:40.712  7396  7411 E Unity   :      at android.os.MessageQueue.next(MessageQueue.java:392)
10-31 14:53:40.712  7396  7411 E Unity   :      at android.os.Looper.loop(Looper.java:136)
10-31 14:53:40.712  7396  7411 E Unity   :      at com.unity3d.player.UnityPlayer$e.run(Unknown Source)
10-31 14:53:40.712  7396  7411 E Unity   : Caused by: java.lang.ClassNotFoundException: Didn't find class "com.unity3d.plugin.UnityAndroidPermissions$IPermissionRequestResult2" on path: DexPathList[[zip file "/data/app/com.vrhouse.ez360-1/base.apk"],nativeLibraryDirectories=[/data/app/com.vrhouse.ez360-1/lib/arm, /data/app/com.vrhouse.ez360-1/base.apk!/lib/armea
10-31 14:53:41.423  7396  7421 E Unity   : java.net.UnknownHostException: Unable to resolve host "config.uca.cloud.unity3d.com": No address associated with hostname

Any idea how to fix it?

Stupid question

This is probably an extremely stupid question, but I have never worked with gradle and rarely with manifest files.

I have added the unityandroidpermissions.aar and AndroidPermissionsManager.cs to my Unity project. I have copied the example code and adjusted it to my project. I can call IsPermissionGranted without any problem, but when I call RequestPermission I get no callback whatsoever. After the call absolutely nothing happens.

I guess it's because I have missed something...probably some change in the manifest file. I can see discussions on if the manifest file should be replaced or merged, but haven't a clue what I need to do in order for either of that to happen.

The document says under "How to build": "Run gradlew assemble from src/UnityAndroidPermissions/"

What is that? Do I need to build, and if so - what am I building? Is it the "gradlew" file that is the "gradlew assemble"? How do I run that? I have tried to run "gradlew.bat" which downloaded a ton of files and then ended with a "build failed" message.

What am I missing?

Corrupted or pink screen on some Android devices after usage of plugin

Hi, at first I want to thank for the plugin and the great work, but I have run to some problems on our project and I am not sure if it's the plugin's fault, my fault, Unity's, Android OS's or some race condition.

I have used the plugin the way it is used in the example project, adapted it in fair standart way in our project. I called the plugin in the first scene of the project after starting the game. On development Android device, everything runs fine, it detects whether the permission is granted and it asks for it if it is not. We are using Unity 5.6.5p3 for the development. The device I developed with is Samsung Galaxy S6 Edge, running on Android 6.

After deploying the build to broader audience, reports started to appear of corrupted textures, whole screen in the first scene pink and so. It seems it affects the UI in particular, everything with textures where is alpha channel. Regular game geometry is OK. On some devices and in certain cases, screen is not pink, but it looks like "hall of mirrors" bug. Basically normal UI framebuffer tiled i.e. in 10x4 matrix.

I think something in this plugin, or the way it is used, corrupts the memory, framebuffer, or the way how Unity works. I know this is very strange as everything it does is running managed code and calling Java. There is maybe some native bridge, but all code in this plugin is managed, either in C# or in Java. So what can corrupt the memory and textures?

It seems (I am not sure of it) that somehow just the presence of the plugin (even before any call to it) somehow corrupts the run of the Unity player from the beginning. Please note that this does not happen on all the devices. I'd say that this happens on 1/10 of the tested devices. I will attach the list of the devices on which it occurs.

Also, this happens when OBB is present. We are able to get to the later scenes, even to main game which certainly uses assets that are in OBB. It is maybe somehow connected to the fact that this happens more often when game is installed from Google Play Store. When we deploy the game via ADB, this happens in almost none of the cases.

What follows is a list of devices, it consist of manufacturer, device, Android version, device code and SoC.

Samsung | Galaxy On5 LTE | 6.0.1 | SM-S550TL | Samsung Exynos 3 Quad 3475
Samsung | Galaxy A3 2016 | 6.0.1 | SM-A310F | Samsung Exynos 7   Quad 7578
LG | Nexus 5 | 6 | D821 | Qualcomm   Snapdragon 800
Samsung | Galaxy J7 Pro | 7 | SM-L730F/DS | Exynos 7870 Octa
Huawei | P9 | 6 | EVA-L09 | HiSilicon Kirin   955
Samsung | Galaxy S6 Edge+ | 7 | SM-G928F | Exynos 7420
Samsung | Galaxy S7 Edge | 7 | SM-G935F | Exynos 8890 Octa
Samsung | Galaxy Tab S2   9.7 | 7 | SM-T810 | Exynos 5433
Huawei | Mate 9 | 7 | MHA-L29 | HiSilicon Honor   KIRIN960 Hi3660
ASUS | ZenPad 3S 10 | 6 | P027 / Z500M | MediaTek MT8176

Do you know what can cause the corrupted screen? Or how to solve it? Is it Unity's issue, plugin issue or ours?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.