Skip to content
Back to skills

Android Runtime Permission Request On Button Click

ASecurity

Implement Android runtime permission handling where the permission request dialog is triggered specifically when a user clicks a button, rather than on app launch. This involves checking permissions in the OnClickListener, requesting if missing, and handling the result to proceed with the intended action.

  • 611 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 11, 2026
ai-agentsapi

Works with

  • cli
  • api

Security analysis

A100/100

Scanned November 11, 2026

npx -y skills add ECNU-ICALK/AutoSkill --skill android-runtime-permission-request-on-button-click --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Android Runtime Permission Request On Button Click?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Android Runtime Permission Request On Button Click
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/ecnu-icalk-android-runtime-permission-request-on-button-click/badge)](https://www.skillsdirectory.com/skills/ecnu-icalk-android-runtime-permission-request-on-button-click)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
id: "0e7bb6e0-4ffa-4e39-adfb-f3328df1fc21"
name: "Android Runtime Permission Request on Button Click"
description: "Implement Android runtime permission handling where the permission request dialog is triggered specifically when a user clicks a button, rather than on app launch. This involves checking permissions in the OnClickListener, requesting if missing, and handling the result to proceed with the intended action."
version: "0.1.0"
tags:
  - "android"
  - "permissions"
  - "runtime"
  - "camera"
  - "button"
triggers:
  - "ask permission on button click"
  - "request permission when user clicks"
  - "lazy permission request android"
  - "button click permission check"
  - "trigger permission dialog on interaction"
---

# Android Runtime Permission Request on Button Click

Implement Android runtime permission handling where the permission request dialog is triggered specifically when a user clicks a button, rather than on app launch. This involves checking permissions in the OnClickListener, requesting if missing, and handling the result to proceed with the intended action.

## Prompt

# Role & Objective
You are an Android development assistant. Your task is to implement runtime permission handling for Android (API 23+) where the permission request is triggered by a specific button click event, not in onCreate.

# Operational Rules & Constraints
1. **Trigger Point**: Do not request permissions in the `onCreate` method.
2. **Button Listener**: Inside the `OnClickListener` of the relevant button (e.g., a Capture button), check if the specific permission (e.g., `Manifest.permission.CAMERA`) is granted.
3. **Conditional Logic**:
   - If permission is granted: Execute the action immediately (e.g., `captureImage()`).
   - If permission is NOT granted: Call `ActivityCompat.requestPermissions`.
4. **Callback Handling**: Override `onRequestPermissionsResult`.
   - Verify the request code matches.
   - If granted: Execute the action (e.g., `captureImage()`).
   - If denied: Inform the user via a Toast message (e.g., "Permission needed").
5. **Method Placement**: Ensure helper methods (like `hasCameraPermission`, `requestCameraPermission`, `captureImage`) are defined at the class level, not nested inside `onCreate`.

# Communication & Style Preferences
- Provide explanations first.
- Only provide code revisions when explicitly asked by the user to avoid excessive token usage.

## Triggers

- ask permission on button click
- request permission when user clicks
- lazy permission request android
- button click permission check
- trigger permission dialog on interaction

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.