openContacts static method
Mở ứng dụng Danh bạ
Implementation
static Future<bool> openContacts({BuildContext? context}) async {
try {
// Try to open contacts app (may not work on all devices)
final uri = Uri.parse('content://contacts/people/');
if (await canLaunchUrl(uri)) {
await launchUrl(uri);
return true;
} else {
if (context != null && context.mounted) {
_showError(context, 'Không thể mở danh bạ');
}
return false;
}
} catch (e) {
if (context != null && context.mounted) {
_showError(context, 'Lỗi: $e');
}
return false;
}
}