小编Cha*_*lot的帖子

如何让我的应用程序出现在app chooser中?

我想宣传我的应用程序能够查看pdf文件,以便在从文件管理器中选择pdf文件时它将显示在应用程序选择器中.

这是我的意图过滤器的样子

<activity
    android:name=".MainActivity"
    android:label="@string/app_name">
    <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.VIEW" />
        <data android:mimeType="application/pdf" />
    </intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)

每当我从文件管理器打开pdf时,它会自动选择另一个名为Polaris Viewer的pdf应用程序.

我在应用程序设置下检查以确保Polaris不是默认应用程序.它说没有设置默认值.

此外,我下载了一个名为Intent Intercept的第三方应用程序.如果我从文件管理器中选择一个pdf文件,则会出现一个应用程序选择器,显示Polaris和Intent Intercept.如果我选择Intent Intercept,它会告诉我Polaris和我的app(Rollout PdfEditor)都符合意图.这是Intent Interceptor的输出:

动作:android.intent.action.VIEW

DATA:file:///storage/sdcard0/Download/download.pdf TYPE:application/pdf

标志:FLAG_ACTIVITY_FORWARD_RESULT FLAG_ACTIVITY_PREVIOUS_IS_TOP

EXTRAS:EXTRA 1:Class:java.lang.Boolean Key:preview Value:false EXTRA 2:Class:java.lang.String Key:key_filename Value:/storage/sdcard0/Download/download.pdf EXTRA 3:Class:android. net.Uri $ HierarchicalUri Key:android.intent.extra.STREAM EXTRA 4:Class:java.lang.Integer Key:sort_order Value:0

2活动与此目标相匹配:Polaris Viewer 4.1(com.infraware.polarisviewer4 - com.infraware.polarisoffice4.OfficeLauncherActivity)Rollout PdfEditor(com.example.rolloutpdfeditor - com.example.rolloutpdfeditor.MainActivity)>

java pdf android android-intent

4
推荐指数
1
解决办法
1625
查看次数

标签 统计

android ×1

android-intent ×1

java ×1

pdf ×1