๐ฏ firebase_fcm_token
A lightweight Flutter package for app status control with server integration and admin panel. Control your app remotely, crash the app when disabled by server, and manage everything through admin panel.
๐จ Critical Feature: App Crash on Disable
When your app is disabled by the server, the application will immediately crash with an Exception instead of showing a white screen. This ensures complete app control and prevents unauthorized usage.
โญ Features
- ๐ซ App Crash Control - Crashes app immediately when disabled by server
- ๐ฅ Exception Throwing - Throws clear exception: "UYGULAMA YรNETฤฐCฤฐ TARAFINDAN KAPATILMIลTIR!"
- ๐ Mandatory Stop - No bypass possible, app terminates completely
- ๐ Server Integration - Connect to your PHP server or custom backend
- ๐จโ๐ผ Admin Panel - Web-based control panel for managing apps
- ๐ฑ Lightweight - No Firebase dependencies, HTTP-only communication
- โก Fast Setup - Easy integration in 5 minutes
๐ Quick Start
1. Add to pubspec.yaml
dependencies:
firebase_fcm_token: ^1.1.3
2. Initialize in main.dart
import 'package:flutter/material.dart';
import 'package:firebase_fcm_token/firebase_fcm_token.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
// Initialize app control
await FirebaseFcmToken().initialize(
appName: 'my_awesome_app',
);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return FirebaseFcmToken().buildAppStatusWidget(
child: MaterialApp(
title: 'My App',
home: const HomePage(),
),
);
}
}
โ ๏ธ Behavior When App Disabled
When the server disables your app:
- Immediate Exception: App throws
Exception('UYGULAMA YรNETฤฐCฤฐ TARAFINDAN KAPATILMIลTIR! Program sonlandฤฑrฤฑlฤฑyor...') - App Crash: Application terminates immediately
- No Bypass: Users cannot continue using the app
- Clear Message: Error message explains why app crashed
๐ง API Reference
FirebaseFcmToken Class
initialize()
await FirebaseFcmToken().initialize(
appName: 'your_app_name', // Required: Your app identifier
serverUrl: 'https://...', // Optional: Custom server URL
);
buildAppStatusWidget()
Widget buildAppStatusWidget({required Widget child})
Returns a widget that crashes the app if disabled by server.
refreshAppStatus()
await FirebaseFcmToken().refreshAppStatus();
Manually refresh app status from server. Will crash app if disabled.
isAppEnabled
bool isEnabled = FirebaseFcmToken().isAppEnabled;
Check if app is currently enabled (before crash).
๐ Server Setup
Upload the included PHP files to your server:
your-domain.com/
โโโ server/
โ โโโ index.php # API endpoint
โ โโโ admin/
โ โ โโโ index.php # Admin panel
โ โ โโโ style.css # Admin styles
โ โโโ config.php # Database config
Database Structure
CREATE TABLE apps (
id INT AUTO_INCREMENT PRIMARY KEY,
app_name VARCHAR(100) UNIQUE NOT NULL,
is_enabled BOOLEAN DEFAULT TRUE,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
Admin Panel Access
- URL:
https://yourdomain.com/server/admin/ - Password:
admin123(change in config.php)
๐ก๏ธ Security Features
- Forced Crash: No way to bypass disabled state
- Exception Handling: Clear error messages
- Server Validation: Regular status checks
- Admin Control: Secure web panel access
๐ Example Usage
class MyHomePage extends StatefulWidget {
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
final FirebaseFcmToken _controller = FirebaseFcmToken();
Future<void> _checkStatus() async {
try {
// This will crash the app if disabled by server
await _controller.refreshAppStatus();
// This code only runs if app is enabled
print('App is enabled: ${_controller.isAppEnabled}');
} catch (e) {
// App crashed due to being disabled
print('App disabled and crashed: $e');
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('My App')),
body: Center(
child: ElevatedButton(
onPressed: _checkStatus,
child: Text('Check Status'),
),
),
);
}
}
๐ Version History
- v1.1.3 - Added app crash feature when disabled
- v1.1.0 - Removed FCM dependencies, app control only
- v1.0.0 - Initial release with FCM support
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ค Support
- ๐ง Email: support@yourcompany.com
- ๐ Issues: GitHub Issues
- ๐ Docs: GitHub Wiki
๐ Contributing
We welcome contributions! Please read our Contributing Guide for details.
โ ๏ธ Important: This package will crash your app when disabled by server. This is intentional behavior for security and control purposes.