لماذا لم يعمل ويظهر ال foreground notification import… · The Chat Archive
Explore لماذا لم يعمل ويظهر ال foreground notification import 'dart:async'; import… Save Share Download ▾ Reportلماذا لم يعمل ويظهر ال foreground notification
import 'dart:async';
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:flutter_foreground_task/flutter_foreground_task.dart';
import 'package:http/http.dart' as http;
void main() {
WidgetsFlutterBinding.ensureInitialized();
FlutterForegroundTask.init(
androidNotificationOptions: AndroidNotificationOptions(
channelId: 'network_monitor_channel',
channelName: 'Network Monitor',
channelDescription: 'عرض حالة الشبكة عند الخروج من التطبيق',
channelImportance: NotificationChannelImportance.LOW,
priority: NotificationPriority.LOW,
),
iosNotificationOptions: const IOSNotificationOptions(
showNotification: true,
playSound: false,
),
foregroundTaskOptions: ForegroundTaskOptions(
autoRunOnBoot: false,
allowWakeLock: true,
allowWifiLock: true,
eventAction: ForegroundTaskEventAction.repeat(
const Duration(seconds: 1) as int,
),
),
);
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Network Monitor',
theme: ThemeData(primarySwatch: Colors.blue, fontFamily: 'Tajawal'),
home: const LoginScreen(),
);
}
}
class LoginScreen extends StatefulWidget {
const LoginScreen({super.key});
@override
State createState() => _LoginScreenState();
}
class _LoginScreenState extends State {
final _formKey = GlobalKey();
final _usernameController = TextEditingController();
final _passwordController = TextEditingController();
bool _isLoggingIn = false;
@override
void dispose() {
_usernameController.dispose();
_passwordController.dispose();
super.dispose();
}
Future _login() async {
if (!_formKey.currentState!.validate()) return;
Show full message · 779 lines Assistant2025-05-25 06:46 UTC Copy response
Copy first prompt
Details
Provider OpenAI
Model provenance As recorded by source dataset
Turns 1 (2 messages)
Language en
Conversation date May 25, 2025
Added to archive Nov 16, 2026
ID 01m7h42vn70hez8fb6s6se3q6hSource & license Imported from WildChat-4.8M (AI2) (source ). Imported records earn no Research Points.
Upstream record: 555f15968e7c484f8657b9c3725c2c4f
Zhao et al., WildChat: 1M ChatGPT Interaction Logs in the Wild (ICLR 2024). Contains information from WildChat-4.8M, made available under the ODC Attribution License.
License: ODC-BY-1.0
setState(() => _isLoggingIn = true);
try {
final response = await http
.post(
Uri.parse('http://172.16.0.1/login'),
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: {
'username': _usernameController.text,
'password': _passwordController.text,
},
)
.timeout(const Duration(seconds: 10));
if (response.statusCode == 200) {
final data = json.decode(response.body);
if (data['status'] == 'success' && mounted) {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder:
(context) => DashboardScreen(
username: _usernameController.text,
userData: {
'username': _usernameController.text,
'ip': data['ip'] ?? 'غير معروف',
'mac': data['mac'] ?? 'غير معروف',
},
),
),
);
} else {
throw Exception(data['message'] ?? 'فشل تسجيل الدخول');
}
} else {
throw Exception('فشل الاتصال بالخادم');
}
} catch (e) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('حدث خطأ: ${e.toString()}'),
backgroundColor: Colors.red,
),
);
}
} finally {
if (mounted) setState(() => _isLoggingIn = false);
}
@override
Widget build(BuildContext context) {
return Directionality(
textDirection: TextDirection.rtl,
child: Scaffold(
backgroundColor: const Color(0xFFF8FAFD),
body: SafeArea(
child: Padding(
padding: const EdgeInsets.all(24.0),
child: Form(
key: _formKey,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const FlutterLogo(size: 100),
const SizedBox(height: 32),
TextFormField(
controller: _usernameController,
decoration: const InputDecoration(
labelText: 'اسم المستخدم',
prefixIcon: Icon(Icons.person),
border: OutlineInputBorder(),
),
validator: (value) {
if (value == null || value.isEmpty) {
return 'الرجاء إدخال اسم المستخدم';
}
return null;
},
),
const SizedBox(height: 16),
TextFormField(
controller: _passwordController,
obscureText: true,
decoration: const InputDecoration(
labelText: 'كلمة المرور',
prefixIcon: Icon(Icons.lock),
border: OutlineInputBorder(),
),
validator: (value) {
if (value == null || value.isEmpty) {
return 'الرجاء إدخال كلمة المرور';
}
return null;
},
),
const SizedBox(height: 24),
SizedBox(
width: double.infinity,
height: 50,
child: ElevatedButton(
onPressed: _isLoggingIn ? null : _login,
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFF2E5BFF),
),
child:
_isLoggingIn
? const CircularProgressIndicator(
color: Colors.white,
)
: const Text(
'تسجيل الدخول',
style: TextStyle(fontSize: 16),
),
),
),
],
),
),
),
),
),
);
}
}
class DashboardScreen extends StatefulWidget {
final String username;
final Map<String, dynamic> userData;
const DashboardScreen({
super.key,
required this.username,
required this.userData,
});
@override
State createState() => _DashboardScreenState();
}
class _DashboardScreenState extends State
with WidgetsBindingObserver {
bool _isLoggingOut = false;
Timer? _timer;
late Map<String, dynamic> _currentUserData;
bool _isForegroundServiceRunning = false;
@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
_currentUserData = widget.userData;
_startPeriodicUpdate();
}
@override
void dispose() {
_timer?.cancel();
WidgetsBinding.instance.removeObserver(this);
_stopForegroundService();
super.dispose();
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
if (!mounted) return;
code Copy code
if (state == AppLifecycleState.paused) {
_startForegroundService();
} else if (state == AppLifecycleState.resumed) {
_stopForegroundService();
}
Future _startForegroundService() async {
if (_isForegroundServiceRunning) return;
code Copy code
await FlutterForegroundTask.startService(
notificationTitle: 'حالة الشبكة - ${_currentUserData['username']}',
notificationText: 'جاري تحديث البيانات...',
callback: startCallback,
);
if (mounted) {
setState(() => _isForegroundServiceRunning = true);
}
Future _stopForegroundService() async {
await FlutterForegroundTask.stopService();
if (mounted) {
setState(() => _isForegroundServiceRunning = false);
}
}
void _startPeriodicUpdate() {
_timer = Timer.periodic(const Duration(seconds: 1), (timer) async {
await _updateUserData();
});
}
code Copy code
if (response.statusCode == 200) {
final data = json.decode(response.body);
if (data.containsKey('errors')) {
return;
}
if (!mounted) return;
setState(() {
_currentUserData = {
'logged_in': data['logged_in'] ?? 'no',
'username': data['username'] ?? widget.username,
'mac': _decodeMacAddress(data['mac'] ?? ''),
'ip': data['ip'] ?? 'غير معروف',
'bytes_in': _formatBytes(data['bytes_in'] ?? '0'),
'bytes_out': _formatBytes(data['bytes_out'] ?? '0'),
'remain_bytes_total': _formatBytes(
data['remain_bytes_total'] ?? '0',
),
'uptime': _formatUptimeExtended(data['uptime'] ?? '0s'),
'session_time_left': _formatSessionTimeLeft(
data['session_time_left'] ?? 'غير محدود',
),
};
});
if (_isForegroundServiceRunning) {
FlutterForegroundTask.updateService(
notificationTitle: 'حالة الشبكة - ${_currentUserData['username']}',
notificationText:
'IP: ${_currentUserData['ip']} | المستلم: ${_currentUserData['bytes_in']} | المرسل: ${_currentUserData['bytes_out']} | المتبقي: ${_currentUserData['session_time_left']}',
);
}
}
} catch (_) {
if (_isForegroundServiceRunning) {
FlutterForegroundTask.updateService(
notificationTitle: 'حالة الشبكة - ${_currentUserData['username']}',
notificationText: 'خطأ في تحديث البيانات',
);
}
}
Future _logout() async {
setState(() => _isLoggingOut = true);
code Copy code
try {
await _stopForegroundService();
final response = await http
.post(
Uri.parse('http://172.16.0.1/logout'),
headers: {'Content-Type': 'application/x-www-form-urlencoded'},
body: {'username': widget.username},
)
.timeout(const Duration(seconds: 10));
if (response.statusCode == 200) {
if (mounted) {
Navigator.pushAndRemoveUntil(
context,
MaterialPageRoute(builder: (_) => const LoginScreen()),
(route) => false,
);
}
} else {
throw Exception('فشل في تسجيل الخروج');
}
} catch (e) {
if (mounted) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('حدث خطأ: ${e.toString()}'),
backgroundColor: Colors.red,
),
);
}
} finally {
if (mounted) {
setState(() => _isLoggingOut = false);
}
}
String _decodeMacAddress(String encodedMac) {
return encodedMac.replaceAll('%3A', ':');
}
String formatBytes(String bytes) {
try {
final value = int.parse(bytes);
if (value < 1024) return 'v a l u e باي ت ′ ; i f ( v a l u e < 1024 ∗ 1024 ) r e t u r n ′ value بايت';
if (value < 1024 * 1024)
return ' v a l u e باي ت ′ ; i f ( v a l u e < 1024 ∗ 1024 ) r e t u r n ′ {(value / 1024).toStringAsFixed(1)} كيلوبايت';
if (value < 1024 * 1024 * 1024)
return '( v a l u e / ( 1024 ∗ 1024 ) ) . t o S t r i n g A s F i x e d ( 1 ) ميجاباي ت ′ ; r e t u r n ′ {(value / (1024 * 1024)).toStringAsFixed(1)} ميجابايت';
return ' ( v a l u e / ( 1024 ∗ 1024 )) . t o S t r in g A s F i x e d {(value / (1024 * 1024 * 1024)).toStringAsFixed(1)} جيجابايت';
} catch ( ) {
return bytes;
}
}
String _formatUptimeExtended(String uptime) {
final regex = RegExp(r'(?:(\d+)d)?(?:(\d+)h)?(?:(\d+)m)?(?:(\d+)s)?');
final match = regex.firstMatch(uptime);
if (match == null) return uptime;
code Copy code
final days = int.tryParse(match.group(1) ?? '0') ?? 0;
final hours = int.tryParse(match.group(2) ?? '0') ?? 0;
final minutes = int.tryParse(match.group(3) ?? '0') ?? 0;
final seconds = int.tryParse(match.group(4) ?? '0') ?? 0;
String result = '';
if (days > 0) result += '$days يوم ';
if (hours > 0) result += '$hours ساعة ';
if (minutes > 0) result += '$minutes دقيقة ';
if (seconds > 0) result += '$seconds ثانية';
return result.trim();
String _formatSessionTimeLeft(String sessionTimeLeft) {
if (sessionTimeLeft == 'غير محدود') return sessionTimeLeft;
return _formatUptimeExtended(sessionTimeLeft);
}
@override
Widget build(BuildContext context) {
return WithForegroundTask(
child: Directionality(
textDirection: TextDirection.rtl,
child: Scaffold(
backgroundColor: const Color(0xFFF8FAFD),
appBar: AppBar(
title: const Text('لوحة التحكم'),
centerTitle: true,
elevation: 0,
backgroundColor: Colors.transparent,
foregroundColor: const Color(0xFF2E5BFF),
automaticallyImplyLeading: false,
),
body: SafeArea(
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
children: [
_buildModernUserCard(context),
const SizedBox(height: 24),
Expanded(
child: GridView.count(
crossAxisCount: 2,
childAspectRatio: 1.1,
crossAxisSpacing: 16,
mainAxisSpacing: 16,
children: [
_buildModernStatCard(
icon: Icons.access_time_rounded,
title: 'مدة الاتصال',
value: _currentUserData['uptime'] ?? 'غير معروف',
color: const Color(0xFF2E5BFF),
),
_buildModernStatCard(
icon: Icons.download_rounded,
title: 'البيانات المستلمة',
value: _currentUserData['bytes_in'] ?? '0',
color: const Color(0xFF00C1D4),
),
_buildModernStatCard(
icon: Icons.upload_rounded,
title: 'البيانات المرسلة',
value: _currentUserData['bytes_out'] ?? '0',
color: const Color(0xFFFF8A34),
),
_buildModernStatCard(
icon: Icons.timer_rounded,
title: 'الوقت المتبقي',
value:
_currentUserData['session_time_left'] ??
'غير محدود',
color: const Color(0xFF50B83C),
),
_buildModernStatCard(
icon: Icons.storage_rounded,
title: 'البيانات المتبقية',
value: _currentUserData['remain_bytes_total'] ?? '0',
color: const Color(0xFF9C6ADE),
),
_buildModernStatCard(
icon: Icons.network_wifi_rounded,
title: 'حالة الاتصال',
value: 'نشط',
color: const Color(0xFFF7C948),
),
],
),
),
const SizedBox(height: 16),
SizedBox(
width: double.infinity,
child: ElevatedButton(
onPressed: _isLoggingOut ? null : _logout,
style: ElevatedButton.styleFrom(
backgroundColor: const Color(0xFFFF453A),
foregroundColor: Colors.white,
padding: const EdgeInsets.symmetric(vertical: 16),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(12),
),
elevation: 0,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
if (_isLoggingOut)
const SizedBox(
width: 20,
height: 20,
child: CircularProgressIndicator(
color: Colors.white,
strokeWidth: 2,
),
)
else
const Icon(Icons.logout_rounded, size: 20),
const SizedBox(width: 8),
Text(
_isLoggingOut
? 'جاري تسجيل الخروج...'
: 'تسجيل الخروج',
style: const TextStyle(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
],
),
),
),
),
),
);
}
Widget _buildModernUserCard(BuildContext context) {
return Container(
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
gradient: const LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [Color(0xFF2E5BFF), Color(0xFF6894FF)],
),
boxShadow: [
BoxShadow(
color: Colors.blue.withOpacity(0.2),
blurRadius: 10,
offset: const Offset(0, 5),
),
],
),
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
children: [
Row(
children: [
Container(
width: 60,
height: 60,
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.2),
shape: BoxShape.circle,
),
child: const Icon(
Icons.person_rounded,
size: 30,
color: Colors.white,
),
),
const SizedBox(width: 16),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
_currentUserData['username'] ?? widget.username,
style: const TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
fontFamily: 'Tajawal',
color: Colors.white,
),
maxLines: 1,
overflow: TextOverflow.ellipsis,
),
const SizedBox(height: 4),
const Text(
'مستخدم Hotspot',
style: TextStyle(
fontSize: 14,
color: Colors.white70,
fontFamily: 'Tajawal',
),
),
],
),
),
],
),
const SizedBox(height: 16),
Divider(color: Colors.white.withOpacity(0.2), height: 1),
const SizedBox(height: 12),
_buildModernInfoRow(
Icons.language_rounded,
'عنوان IP:',
_currentUserData['ip'] ?? 'غير معروف',
Colors.white,
),
_buildModernInfoRow(
Icons.settings_ethernet_rounded,
'عنوان MAC:',
_currentUserData['mac'] ?? 'غير معروف',
Colors.white,
),
],
),
),
);
}
Widget _buildModernInfoRow(
IconData icon,
String label,
String value,
Color color,
) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8),
child: Row(
children: [
Icon(icon, size: 20, color: color.withOpacity(0.8)),
const SizedBox(width: 12),
Text(
label,
style: TextStyle(
fontWeight: FontWeight.bold,
fontFamily: 'Tajawal',
fontSize: 15,
color: color.withOpacity(0.9),
),
),
const SizedBox(width: 8),
Expanded(
child: Text(
value,
style: TextStyle(
color: color,
overflow: TextOverflow.ellipsis,
fontFamily: 'Tajawal',
),
),
),
],
),
);
}
Widget _buildModernStatCard({
required IconData icon,
required String title,
required String value,
required Color color,
}) {
return Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(16),
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.1),
blurRadius: 10,
offset: const Offset(0, 5),
),
],
),
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
padding: const EdgeInsets.all(10),
decoration: BoxDecoration(
color: color.withOpacity(0.1),
borderRadius: BorderRadius.circular(12),
),
child: Icon(icon, size: 24, color: color),
),
const SizedBox(height: 12),
Text(
value,
style: const TextStyle(
fontFamily: 'Tajawal',
fontSize: 16,
fontWeight: FontWeight.bold,
color: Color(0xFF2E384D),
),
),
const SizedBox(height: 4),
Text(
title,
style: const TextStyle(
fontFamily: 'Tajawal',
fontSize: 13,
color: Color(0xFF8798AD),
),
),
],
),
),
);
}
}
@pragma('vm:entry-point')
void startCallback() {
FlutterForegroundTask.setTaskHandler(NetworkStatusTaskHandler());
}
class NetworkStatusTaskHandler extends TaskHandler {
@override
Future onStart(DateTime timestamp, TaskStarter taskStarter) async {
// إعدادات عند بدء الخدمة
}
@override
Future onEvent(DateTime timestamp) async {
try {
final response = await http
.get(Uri.parse('http://172.16.0.1/status?var=json '))
.timeout(const Duration(seconds: 10));
code Copy code
if (response.statusCode == 200) {
final data = json.decode(response.body);
if (data.containsKey('errors')) return;
final username = data['username'] ?? 'غير معروف';
final ip = data['ip'] ?? 'غير معروف';
final bytesIn = _formatBytes(data['bytes_in'] ?? '0');
final bytesOut = _formatBytes(data['bytes_out'] ?? '0');
final sessionTimeLeft = data['session_time_left'] ?? 'غير محدود';
await FlutterForegroundTask.updateService(
notificationTitle: 'حالة الشبكة - $username',
notificationText:
'IP: $ip | المستلم: $bytesIn | المرسل: $bytesOut | المتبقي: $sessionTimeLeft',
);
}
} catch (_) {
await FlutterForegroundTask.updateService(
notificationTitle: 'حالة الشبكة',
notificationText: 'خطأ في تحديث البيانات',
);
}
@override
void onRepeatEvent(DateTime timestamp) {
// يمكنك ترك هذه فارغة أو تنفيذ مهام أخف إذا أردت، لكن لا يمكن استدعاء دوال async هنا
}
@override
Future onDestroy(DateTime timestamp, bool isOnMainThread) async {
// تنظيف الموارد إذا لزم الأمر
}
String formatBytes(String bytes) {
try {
final value = int.parse(bytes);
if (value < 1024) return 'v a l u e باي ت ′ ; i f ( v a l u e < 1024 ∗ 1024 ) r e t u r n ′ value بايت';
if (value < 1024 * 1024)
return ' v a l u e باي ت ′ ; i f ( v a l u e < 1024 ∗ 1024 ) r e t u r n ′ {(value / 1024).toStringAsFixed(1)} كيلوبايت';
if (value < 1024 * 1024 * 1024)
return '( v a l u e / ( 1024 ∗ 1024 ) ) . t o S t r i n g A s F i x e d ( 1 ) ميجاباي ت ′ ; r e t u r n ′ {(value / (1024 * 1024)).toStringAsFixed(1)} ميجابايت';
return ' ( v a l u e / ( 1024 ∗ 1024 )) . t o S t r in g A s F i x e d {(value / (1024 * 1024 * 1024)).toStringAsFixed(1)} جيجابايت';
} catch ( ) {
return bytes;
}
}
}
أسباب عدم ظهور notification للخدمة في المقدمة (foreground notification) عند استخدام flutter_foreground_task في كودك:
عدم تهيئة أو إطلاق الخدمة بشكل صحيح:
تأكد من أن FlutterForegroundTask.startService يتم استدعاؤها فعليًا، وهذا يبدو صحيحًا في كودك داخل _startForegroundService التي تستدعى عند AppLifecycleState.paused.
خطأ في استخدام eventAction في FlutterForegroundTask.init:
dart Copy code
foregroundTaskOptions: ForegroundTaskOptions(
autoRunOnBoot: false,
allowWakeLock: true,
allowWifiLock: true,
eventAction: ForegroundTaskEventAction.repeat(
const Duration(seconds: 1) as int, // هنا خطأ!
),
),
أنت تحاول تمرير Duration كم عدد صحيح (int) وهذا خطأ.
الصيغة الصحيحة يجب أن تكون:
dart Copy code
eventAction: ForegroundTaskEventAction.repeat(
intervalMilliseconds: 1000, // عدد مليثانية كعدد صحيح
),
repeat تأخذ عدد الميلي ثانية كوسيط.
الصواب:
dart Copy code
foregroundTaskOptions: ForegroundTaskOptions(
autoRunOnBoot: false,
allowWakeLock: true,
allowWifiLock: true,
eventAction: ForegroundTaskEventAction.repeat(
intervalMilliseconds: 1000,
),
),
لا تنسى إضافة صلاحيات الـ foreground service داخل AndroidManifest.xml:
أضف المطلوبات:
xml Copy code
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
داخل <manifest>، وأيضًا داخل <application>:
xml Copy code
<service
android:name="com.pravera.flutter_foreground_task.service.ForegroundService"
android:exported="false" />
تأكد من تهيئة القناة (channel) داخل النظام:
في AndroidNotificationOptions أنت تستخدم channelId, channelName، وهذا جيد، لكن تأكد أن اسم القناة فريد ومتناسب.
والأفضل تعيين channelImportance إلى IMPORTANCE_DEFAULT بدلاً من LOW، لأن LOW قد يجعل الإعلام لا يظهر ظاهرًا أو ربما يظهر مخفياً في الإشعارات.
dart Copy code
androidNotificationOptions: AndroidNotificationOptions(
channelId: 'network_monitor_channel',
channelName: 'Network Monitor',
channelDescription: 'عرض حالة الشبكة عند الخروج من التطبيق',
channelImportance: NotificationChannelImportance.DEFAULT,
priority: NotificationPriority.DEFAULT,
),
تأكد أن الـ callback startCallback معرف بشكل صحيح ويدعم foreground task:
يجب أن يكون محدد مع @pragma('vm:entry-point') (وهو موجود في كودك).
فحص سجل الأخطاء (logcat) على الأندرويد عند تشغيل الخدمة للتأكد من عدم وجود أخطاء في تشغيل foreground service.
خلاصة خطوات التعديل الرئيسية:
dart Copy code
eventAction: ForegroundTaskEventAction.repeat(intervalMilliseconds: 1000),
غيّر مستوى أهمية القناة إلى DEFAULT أو HIGH.
أضف التصريح FOREGROUND_SERVICE في AndroidManifest.xml.
راجع سجل النظام Debug log لتشخيص المشكلة.
مثال كامل للتعديل:
dart Copy code
FlutterForegroundTask.init(
androidNotificationOptions: AndroidNotificationOptions(
channelId: 'network_monitor_channel',
channelName: 'Network Monitor',
channelDescription: 'عرض حالة الشبكة عند الخروج من التطبيق',
channelImportance: NotificationChannelImportance.DEFAULT, // بدل LOW
priority: NotificationPriority.DEFAULT, // بدل LOW
),
iosNotificationOptions: const IOSNotificationOptions(
showNotification: true,
playSound: false,
),
foregroundTaskOptions: ForegroundTaskOptions(
autoRunOnBoot: false,
allowWakeLock: true,
allowWifiLock: true,
eventAction: ForegroundTaskEventAction.repeat(
intervalMilliseconds: 1000,
),
),
);
إذا فعلت ما سبق ومازال لا يظهر، قم بمشاركة سجل الأخطاء من الـ logcat لتشخيص أفضل.
Copy first response
Not yet included in a published release.
(
1
)
ميجاباي
ت ′
;
r
e
t
u
r
n ′
(
1
)
ميجاباي
ت ′
;
r
e
t
u
r
n ′