我试图在我的应用上设置过滤器,因此我可以收听不同的电子邮件应用程序,但我总是收到错误:&#34; String type not allowed at <data android:type="*/*" />
&#34;
我如何更改它以便它可以收听我的所有电子邮件应用程序,以及如何更改它以便我可以收听特定的应用程序而不是所有应用程序?
这是我的清单
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.filipecosta.mytasks">
<uses-permission android:name="android.permission.CALL_PHONE" />
<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".TaskActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<data android:type="*/*" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="mailto" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
<activity android:name=".PhoneCall"></activity>
</application>
</manifest>
答案 0 :(得分:0)
type
没有属性<data>
。只需使用android:mimeType
代替android:type
试试这个:
<intent-filter>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="*/*" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
详细信息:https://developer.android.com/guide/topics/manifest/data-element.html
答案 1 :(得分:0)
中没有属性
type
只需mimeType
。
https://developer.android.com/guide/topics/manifest/intent-filter-element.html?hl=en-419
答案 2 :(得分:-1)
我认为你想要MIME类型,所以android:mimeType="*/*"
。