I want to open a gmail inbox through my application

How to open a mailbox in our applications.

final String ACCOUNT_TYPE_GOOGLE = "com.google"; final String[] FEATURES_MAIL = { "service_mail" }; AccountManager.get(this).getAccountsByTypeAndFeatures(ACCOUNT_TYPE_GOOGLE, FEATURES_MAIL, new AccountManagerCallback() { @Override public void run(AccountManagerFuture future) { Account[] accounts = null; try { accounts = future.getResult(); if (accounts != null && accounts.length > 0) { String selectedAccount = accounts[0].name; queryLabels(selectedAccount); } 
+4
source share
1 answer

If you always want to open gmail and make sure the client has a gmail application, you can use it to launch the gmail application, which has incoming messages as opening activity.

 PackageManager manager = getPackageManager(); Intent i = manager.getLaunchIntentForPackage("com.google.android.gmail"); i.addCategory(Intent.CATEGORY_LAUNCHER); startActivity(i); 
+1
source

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


All Articles