我正在编写一个应用程序,以编程方式添加IMAP / POP3帐户。问题是,我无法将其显示在“帐户和同步设置”中。
Account account = new Account(context);
account.se;
account.setDescription("acc added thr prog");
account.setAutomaticCheckIntervalMinutes(10);
account.setEmail("UserName@gmail.com");
account.setDraftsFolderName("Drafts");
account.setOutboxFolderName("OutBox");
account.setSentFolderName("Sent");
account.setTrashFolderName("Trash");
account.setName("Tester");
account.setNotifyNewMail(true);
account.setSenderUri(mContext,"smtp+ssl+://UserName%40gmail.com:Password@smtp.gmail.com");
mAccount.setStoreUri(mContext,"imap+ssl+://UserName%40gmail.com:Password@imap.gmail.com");
account.setDeletePolicy(10);
account.setVibrate(true);
mPrefer = Preferences.getPreferences(getInstrumentation().getContext());
account.save(mPrefer);
Object mInstrumenatation;
Email.setServicesEnabled(mInstrumenatation.getTargetContext());
感谢。