Before the user send his message or attachements to a mail provider, the app should check if there is any mail provider available. If the mail provider is not available, we don't need to trigger the method 'send' because it will not executed successfully:
i have implemented a solution for android and iOS which is similiar to actual plugin code:
android function:
private fun hasProvider(callback: Result){
if (activity == null) {
callback.success(false)
return
}
val intent = Intent()
intent.action = Intent.ACTION_SENDTO
intent.data = Uri.parse("mailto:")
val packageManager = activity?.packageManager
if (packageManager?.resolveActivity(intent, 0) != null) {
callback.success(true)
} else {
callback.success(false)
}
}
Before the user send his message or attachements to a mail provider, the app should check if there is any mail provider available. If the mail provider is not available, we don't need to trigger the method 'send' because it will not executed successfully:
i have implemented a solution for android and iOS which is similiar to actual plugin code:
android function:
iOS function: