Code Monkey home page Code Monkey logo

Comments (9)

nabinbhandari avatar nabinbhandari commented on July 16, 2024

Hello, thank you for your feedback. I have also found some of some crashes from Google Play console. However, I am unable to reproduce the issue. Can you provide me with a minimal code and/or scenario that leads to the crash?

from android-permissions.

wahibhaq avatar wahibhaq commented on July 16, 2024

Basically, it goes like this:

  1. you are doing the permission check in a service (foreground) and it is running with a foreground notification.
  2. you go to app's permissions in Settings and disable "Location" as in my case
  3. System will kill the application but I have set Service to be START_STICKY in onStartCommand() so it will recreate it.
  4. I will see the rational dialog saying that this app needs location permission. Usually its quite fast and you see the dialog while you are on the app permission in Settings.

Now at this point, the app itself also appears in background and I think because of PermissionActivity. Problem occurs when you try to bring the app to foreground because it will crash and you will see the error in the logs which I mentioned in my first comment.

I know it's quite an edge case but still a relevant one in my case where user can revoke the permission and I would like to show a dialog to make him aware of the consequences.

from android-permissions.

wahibhaq avatar wahibhaq commented on July 16, 2024

I might have tried to fix it myself but lack extra time to invest so maybe there is something you can do about it otherwise I will find a workaround.

from android-permissions.

nabinbhandari avatar nabinbhandari commented on July 16, 2024

Hello, I have made an attempt to fix the issue. Can you please checkout the branch "temp" and verify if it has been solved?

To test:

  • Checkout branch 'temp'.
  • Run the task 'assembleRelease' of module 'permissions' in Gradle.
  • Locate the AAR file in the build/outputs/aar
  • Use the AAR file as dependency in your project instead of gradle dependency.

from android-permissions.

wahibhaq avatar wahibhaq commented on July 16, 2024

THanks @nabinbhandari for the effort. I will try it out and will share my feedback.

from android-permissions.

wahibhaq avatar wahibhaq commented on July 16, 2024

No man, unfortunately it is still getting the same error. I definitely used the permissions-release.aar file and used the module instead of the global dependency.

    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.blah.blah.debug/com.nabinbhandari.android.permissions.PermissionsActivity}: java.lang.IllegalArgumentException: permission cannot be null or empty
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2927)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988)
        at android.app.ActivityThread.-wrap14(ActivityThread.java)
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631)
        at android.os.Handler.dispatchMessage(Handler.java:102)
        at android.os.Looper.loop(Looper.java:154)
        at android.app.ActivityThread.main(ActivityThread.java:6682)
        at java.lang.reflect.Method.invoke(Native Method)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410)
     Caused by: java.lang.IllegalArgumentException: permission cannot be null or empty
        at android.content.pm.PackageManager.buildRequestPermissionsIntent(PackageManager.java:4054)
        at android.app.Activity.requestPermissions(Activity.java:4294)
        at com.nabinbhandari.android.permissions.PermissionsActivity.onCreate(PermissionsActivity.java:72)
        at android.app.Activity.performCreate(Activity.java:6942)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1126)
        at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2880)
        at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2988) 
        at android.app.ActivityThread.-wrap14(ActivityThread.java) 
        at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1631) 
        at android.os.Handler.dispatchMessage(Handler.java:102) 
        at android.os.Looper.loop(Looper.java:154) 
        at android.app.ActivityThread.main(ActivityThread.java:6682) 
        at java.lang.reflect.Method.invoke(Native Method) 
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1520) 
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1410) 

Probably, I will let the service not start again once permissions are revoked but show a notification as a fallback plan.

from android-permissions.

nabinbhandari avatar nabinbhandari commented on July 16, 2024
at android.app.Activity.requestPermissions(Activity.java:4294)
at com.nabinbhandari.android.permissions.PermissionsActivity.onCreate(PermissionsActivity.java:72)

I am sure you are still using the old code because the source code has changed and line of crash is still the same.

Perhaps you checked out the master branch instead of temp.

from android-permissions.

wahibhaq avatar wahibhaq commented on July 16, 2024

Ahan, maybe I made a mistake. Let me try again.

from android-permissions.

nabinbhandari avatar nabinbhandari commented on July 16, 2024

The crash has been fixed. Thank you.

from android-permissions.

Related Issues (20)

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.