How to implement android.intent.action.VIEW completion action handler?



  • How do I pass the file path to my application to handle viewing of the file?

    What I Have Done:

    I added an intent-filter to my Qt app and it seems to work.

    Selecting a *.TSL data file in the app File Manager HD now displays my application so that when I select Open As, Text it displays my app as an option to "Complete action using"

    My app is succesfully launched when I choose it to "Complete action using" and select "Just Once".

    Under desktop targets such as Linux, OSX, Windows, this works by passing the file to open as a command line argument. What is the Qt Android way?

    Can an android.intent.action.VIEW work with an already open application?

    File: AndroidManifest.xml
    @
    <?xml version="1.0"?>
    <manifest package="com.ditchwitch.tsr" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0" android:versionCode="1" android:installLocation="auto">
    <application android:hardwareAccelerated="true" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="@string/app_name" android:icon="@drawable/icon">
    <activity android:allowTaskReparenting="true" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|locale|fontScale|keyboard|keyboardHidden|navigation" android:name="org.qtproject.qt5.android.bindings.QtActivity" android:label="@string/app_name" android:screenOrientation="sensor" android:launchMode="singleTop">
    <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" />
                <category android:name="android.intent.category.BROWSABLE" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:scheme="http" />
                <data android:host="*" />
                <data android:pathPattern=".*\\\\.TSL" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.BROWSABLE" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:scheme="http" />
                <data android:host="*" />
                <data android:mimeType="application/TSL" />
            </intent-filter>
    
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:scheme="file" />
                <data android:host="*" />
                <data android:pathPattern=".*\\\\.TSL" android:mimeType="*/*" />
            </intent-filter>
    

    @

    Thanks in advance,

    -Ed



  • 2.2k views and not even one answer, wondering about the same thing right now


  • Qt Champions 2016

    perhaps this blog helps ?
    http://blog.qt.io/blog/2016/06/30/intents-with-qt-for-android-part-1/

    and here's my wish list ;-)
    @eskil-abrahamsen-blomfeldt - waiting for part-2 ...

    @Jake-Petroules would be cool to get examples HowTo deal with iOS extensions
    http://blog.qt.io/blog/2016/06/30/intents-with-qt-for-android-part-1/#comment-1198052


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.