以编程方式删除Gmail电子邮件

以编程方式删除Gmail电子邮件

本文介绍了以编程方式删除Gmail电子邮件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理我在自己的应用程序中访问Gmail电子邮件的应用程序,但是我无法通过其ID来删除这些电子邮件。如何做到这一点?

I am working on an application in which I am accessing Gmail emails in my own application, but I am unable to delete those emails through their id. How can I do this?

delete.setOnClickListener(new OnClickListener() {

    @Override
    public void onClick(View arg0) {
        // TODO Auto-generated method stub
        try {
            Uri uri = Uri.parse((new StringBuilder()).append(
                "content://gmail-ls/messages/").append(account_name).append("/").append(mail_id).toString());
            getContentResolver().delete(uri, null, null);
            Toast.makeText(cont, "Deleted", Toast.LENGTH_SHORT).show();

            // getContentResolver().delete(
            // Uri.parse("content://gmail-ls/conversations/"
            // + account_name + "/" + mail_id + ""), null,
            // null);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

});


推荐答案

除了你的问题似乎(你做了没有指定,但是听起来你可以阅读邮件吗?),你不能真正依赖这个功能。

Apart from whatever your problem seems to be (you did not specify it, but it sounds like you can read the mails?), you cannot really rely on this feature.

这个工作的最后一个版本是2.3.4.1
请参阅:

The last version for which this works is 2.3.4.1See: http://groups.google.com/a/googleproductforums.com/forum/#!category-topic/gmail/reading-and-receiving-messages/XD0C4sw9K7U

其次,我不认为这个方法只是读取权限。

And secondly, I don't think this method was more then just read permission.

这篇关于以编程方式删除Gmail电子邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 08:58