firebase_fcm_token 1.1.3
firebase_fcm_token: ^1.1.3 copied to clipboard
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.
π― 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.