是否可以拦截来自Android的外发电子邮件?我曾使用ContentObserver尝试过内容提供商,但仍然没有运气。
这是我的代码。
final String AUTHORITY_PLUS_MESSAGES = "content://gmail-ls/messages/";
String[] gmailAccounts = getGmailAccount(this.getApplicationContext());
String firstEmailAddress = gmailAccounts[0];
Handler handler = new Handler();
ContentResolver resolver = getContentResolver();
ContentObserver observer = new GmailObserver(handler, resolver, firstEmailAddress);
Uri uri = Uri.parse(AUTHORITY_PLUS_MESSAGES + firstEmailAddress + "/");
resolver.registerContentObserver(uri, Boolean.TRUE, observer);
class GmailObserver extends ContentObserver {
public void onChange(final boolean bSelfChange) {
super.onChange(bSelfChange);
Log.d(TAG, "***** onChange");
// here I am getting lots of calls but not sure how to deal with outgoing messages ..
}
}
答案 0 :(得分:2)
是否可以拦截来自Android的外发电子邮件?
不,抱歉。