Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-82884

Open Qt app based on file extension on Android

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.6.1
    • Extras: Android
    • None
    • Android
    • Next

    Description

      Similar to QTBUG-70170 it would be useful to launch an Android app based on the file extension. The following entry to the AndroidManifest.xml file starts the app. Now it would be nice if the passed url is provided:

      <intent-filter android:icon="@mipmap/ic_launcher" android:label="My music player" android:priority="1">
      	<action android:name="android.intent.action.VIEW"/>
      	<category android:name="android.intent.category.DEFAULT"/>
      	<category android:name="android.intent.category.BROWSABLE" />
      
      	<data android:scheme="content"/>
      	<data android:scheme="file"/>
      	<data android:host="*"/>
      	<data android:mimeType="audio/mp3"/>
      	<data android:pathPattern=".*\\.mp3"/>
      </intent-filter>
      

      onCreate and onNewIntent can then check and process the Uri:

      Uri uri = getIntent().getData();
      if (uri != null && ((getIntent().getFlags() & Intent.FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY)) == 0)
         // process Uri and pass it to Qt
      

      The uri could then be opened using QFile::open.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtandroidteam Qt Android Team
              DanielSt Peter Staab
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes