如何在我们的应用中打开收件箱。
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);
}
答案 0 :(得分:1)
如果你总是想打开gmail,并确定客户端有gmail应用程序,你可以使用它来启动gbox应用程序,它将收件箱作为开放活动。
PackageManager manager = getPackageManager();
Intent i = manager.getLaunchIntentForPackage("com.google.android.gmail");
i.addCategory(Intent.CATEGORY_LAUNCHER);
startActivity(i);