Double Back to Close
CodingwithRK
NativePHP^3.0iOS18.2+Android26+
Prompt users to press back twice before exiting the app. On the first back press a native toast is shown ("Press back again to exit"). If the user presses back again within the timeout the app exits.
Android only. iOS is a no-op as it has no hardware back button.
Features
- Double-tap back button detection with configurable timeout
- Customizable toast messages
- Native Android Toast or dialog-based notifications
- Cross-platform PHP/JavaScript API
- Event-driven architecture
Installation
composer require codingwithrk/double-back-to-close
php artisan vendor:publish --tag=nativephp-plugins-provider
php artisan native:plugin:register codingwithrk/double-back-to-close
php artisan native:plugin:register nativephp/mobile-dialog
Compatibility
| Platform | Minimum Version |
|---|---|
| NativePHP | ^3.0 |
| iOS | 18.2+ (no-op) |
| Android | API 26+ |
Events
DoubleBackToCloseTriggered— fires on first back pressAppExiting— fires on second back press before exit