How to write code for Clear Email Client settings in android?

enter image description here Iโ€™m working on a chat-related application, in this application I will share information so that by default any email client works fine, in this application I add settings in the settings, which one parameter adds โ€œClear email client settingsโ€, suppose that click on it again the default dialog box for the mail option will appear. How to clear email settings in android? Send me any solution.

Intent i = new Intent(Intent.ACTION_SEND); i.setType("text/html"); i.putExtra(Intent.EXTRA_SUBJECT, "Mail from Mobile Application"); String emailbody=""; emailbody=String.format("<html>"+ "<head>"+ "<meta name='viewport' content='width=device-width; initial-scale=1.0; maximum-scale=2.0;'>"+ "</head>"+ "<body> " + "<b>Reference : </b> %s"+"<br><br>" + "</body>"+ "</html>", s_ref); i.putExtra(Intent.EXTRA_TEXT,Html.fromHtml(emailbody)); try { startActivity(Intent.createChooser(i, "Send mail...")); } catch (android.content.ActivityNotFoundException ex) { Toast.makeText(this, "There are no email clients installed.", Toast.LENGTH_SHORT).show(); } 
+4
source share
1 answer

I believe that this can no longer be done. Since Gingerbread, Android does not provide developers with access to a specific method called clearApplicationUserData(String packageName, learUserDataObserver mClearDataObserver) . Thus, you cannot do this without any illegal hacks.

A source

0
source

Source: https://habr.com/ru/post/1486751/


All Articles