react-native-mail
react-native-mail copied to clipboard
Error : not_available in Android 13 with only GMail App
The Mailer function is unable to detect GMail as a mailing App on the phone with Android 13 when its the only mailing App present.
Case 1: Only GMail as a mailing App present. Signed-in already. It returns the above error. Unable to find the GMail App as an option to send the mail through. Case 2: = 2 mailing Apps present. It opens the another App by default without showing GMail as an option to select. Case 3: > 2 Mailing Apps present. It shows option to select all mailing Apps with GMail also. Here GMail option works as intended, with To, Subject, Body and Attachment all present.
Note: 1. Outlook App opens with Compose Mail, but the body text doesn't load. Other details gets filled up as intended. 2. RediffMail App opens on Inbox open. Doesn't go to Compose Mail section.
Facing Same Issue...@yusufsham are you able to get solution for it.
I have found a work around. As the latest package is unable to find the GMail app if its the only existing mailing App, I have modified the library a bit. Please find the Solution below: Replace the following file in the node_modules > react-native-mail > android > src > main > java > com > chirag > RNMail > RNMailModule.java
Then use patch-package library to patch the code and include it in the build. https://github.com/ds300/patch-package#readme
Note: Make sure you catch the error, thrown by the package, where you actually use Mailer function in your code.
package com.chirag.RNMail;.txt
Update: The above patch is not working with the latest Android Security Patch March 2023. I am looking into it. Meanwhile any help would be highly appreciated.
@yusufsham Thanks for giving work around
Are there any plans for a PR?
Are there any plans for a PR?
This is not a proper fix, but a workaround. Let the maintainers do it in a cleaner way. Or else I'll get it done that way and then generate a PR, (When I get time!! ;p)
I think the fix is in this post. We just need to set a proper flag I believe.
https://stackoverflow.com/questions/73666471/how-to-solve-queryintentactivities-deprecated-in-api-33/73920935
Or maybe we don't need it at all since the chooser has a "use always" option...
I have found a work around. As the latest package is unable to find the GMail app if its the only existing mailing App, I have modified the library a bit. Please find the Solution below: Replace the following file in the node_modules > react-native-mail > android > src > main > java > com > chirag > RNMail > RNMailModule.java
Then use patch-package library to patch the code and include it in the build. https://github.com/ds300/patch-package#readme
Note: Make sure you catch the error, thrown by the package, where you actually use Mailer function in your code.
@yusufsham Can you explain your work around? What code did you change?
@yusufsham @joshua-revolutions is library working in iOS... I am not able to see the email client popup...
@chirag04 Please find the PR for Android 13 compatibility tested up to March 23 security Update. I have used a filter technique for filtering out Mailing Apps from the resolved list. Please clean it to be more efficient, if you could. https://github.com/chirag04/react-native-mail/pull/197