我刚刚升级到新版本的gmail(v2.3.5),我有一个应用程序查询内容提供商,以获取有关收到消息的联系人的详细信息......
使用最新版本我收到以下错误:
java.lang.SecurityException:Permission Denial:从ProcessRecord打开提供程序com.google.android.gm.provider.MailProvider {40adef58 3576:com.rageconsulting.android.lightflow/10056}(pid = 3576,uid = 10056)需要com. google.android.gm.permission.READ_GMAIL或com.google.android.gm.permission.WRITE_GMAIL`
对于我的清单中的gmail,我声明了以下内容:
<!--permissions for gmail-->
<uses-permission android:name="com.google.android.googleapps.permission.GOOGLE_AUTH"/>
<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="com.google.android.providers.gmail.permission.READ_GMAIL"/>
<uses-permission android:name="com.google.android.gm.permission.READ_GMAIL"/>
<uses-permission android:name="com.google.android.gm.permission.WRITE_GMAIL"/>
Run Code Online (Sandbox Code Playgroud)
所以据我所知,我的权限是正确的.
我的gmail接收器如下所示:
<receiver android:name=".receiver.GmailReceiver">
<intent-filter>
<action android:name="android.intent.action.PROVIDER_CHANGED" android:priority="-10">
</action>
<data android:scheme="content" android:host="gmail-ls" android:pathPattern="/unread/.*">
</data>
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.PROVIDER_CHANGED" android:priority="-10">
</action>
<data android:mimeType="*/*" android:scheme="content" android:host="gmail-ls" android:path="/unread/^i">
</data>
</intent-filter>
</receiver>
Run Code Online (Sandbox Code Playgroud)
谁能想到我可能错过的东西?
我有一个应用程序,我使用intent发送电子邮件,如下所示:
//TODO attach and send here
try {
Log.i(getClass().getSimpleName(), "send task - start");
String address = "emailHere@yahoo.com";
String subject = "Order of " + customer + " for " + date;
String emailtext = "Please check the attached file. Attached file contains order of " + customer;
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND_MULTIPLE);
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] { address });
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, subject);
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, emailtext);
ArrayList<Uri> uris = new ArrayList<Uri>();
Uri uriList = Uri.fromFile(orderListFile);
uris.add(uriList);
emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
this.startActivity(Intent.createChooser(emailIntent, "Send mail..."));
} …Run Code Online (Sandbox Code Playgroud)