Mobile Phone Blocker
🚀 Use Case / Purpose
A Flutter plugin designed to lock and secure Android devices. It leverages Android DevicePolicyManager to restrict user actions, disable the status bar, and enter kiosk mode.
Example scenario (EMI Financing):
1. User buys phone on EMI.
2. Finance app installs EMI locker.
3. Device locks on missed payment.
4. Unlocks automatically after payment verification.
1. User buys phone on EMI.
2. Finance app installs EMI locker.
3. Device locks on missed payment.
4. Unlocks automatically after payment verification.
✨ Features
- Lock Device: Secures the device, pins app, disables status bar, and hides settings. Prevents safe boot, app installation, and factory reset.
- Unlock Device: Removes restrictions and restores normal device operation.
- EMI Status Check: Includes
EmiServiceto verify payment status before unlocking.
⚙️ Setup
IMPORTANT: For this plugin to work, the app MUST be set as the Device Owner. This requires a Factory Reset first.
Method 1: ADB Command
adb shell dpm set-device-owner your.application.id/com.emi.locker.MyDeviceAdminReceiver
Method 2: QR Code Provisioning
Tap the "Welcome" screen 6 times to open the QR scanner and scan a payload like this:
{
"android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME": "com.emi.locker/.MyDeviceAdminReceiver",
"android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION": "https://github.com/Amarj234/flutter_learn_advance/releases/download/apkupload/emi-locker.apk",
"android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM": "BASE64_SHA256_HERE",
"android.app.extra.PROVISIONING_SKIP_ENCRYPTION": true
}
💻 Usage
Add to pubspec.yaml:
dependencies: mobile_phone_blocker: # latest
Dart implementation:
// Lock the device await DeviceControl.lockDevice(); // Unlock the device await DeviceControl.unlockDevice();
-
👨💻 Project Info
🔹 Author: AmarJeet Kushwaha
🔹 Category: Flutter Plugin / Security
🔹 Platform: Android (Enterprise)
🔹 Core Tech: Flutter, Kotlin, DevicePolicyManager
EmiService Example
final emiService = EmiService();
bool paid = await emiService.isEmiPaid();
if (paid) {
await DeviceControl.unlockDevice();
}