4

How to open inbox in our apps.

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); } 
2
  • Does it have to be GMail? The usual way would be to use the SEND intent and then pick Gmail out of the list. Commented Aug 13, 2013 at 12:09
  • Welcome to SO. Please read the FAQ about how to ask good questions. Tell us your link you mentioned plus what you mean by "not working". Do you get any error? If so show them to us by editing your question and paste the stack trace there. Commented Aug 13, 2013 at 12:10

1 Answer 1

1

If you always want to open gmail, and sure that client has gmail application, you can use this to start gmail application, which has inbox as opening activity.

PackageManager manager = getPackageManager(); Intent i = manager.getLaunchIntentForPackage("com.google.android.gmail"); i.addCategory(Intent.CATEGORY_LAUNCHER); startActivity(i); 
Sign up to request clarification or add additional context in comments.

1 Comment

thanks sir , but i want open inbox in app and with notification. send me proper code to this programm by sandeep kushwah