Frage zu Dateiverknüpfungen auf Android

Support for Android version of Total Commander

Moderators: white, Hacker, petermad, Stefan2

franc
Senior Member
Senior Member
Posts: 259
Joined: 2005-10-27, 14:09 UTC

Post by *franc »

Kedge wrote:... Auf meinen Telefon ist es die Kingsoft Ofice Suite

https://play.google.com/store/apps/details?id=cn.wps.moffice_eng&feature=search_result#?t=W251bGwsMSwxLDEsImNuLndwcy5tb2ZmaWNlX2VuZyJd

Vielleicht findet sich ja ein Muster.
Ja, auch hier wurde dann wohl mal wieder das host Attribut vergessen:

Code: Select all

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <action android:name="android.intent.action.EDIT" />
                <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:pathPattern=".*\\.txt" />
                <data android:pathPattern=".*\\.log" />
                <data android:pathPattern=".*\\.ppt" />
                <data android:pathPattern=".*\\.pot" />
                <data android:pathPattern=".*\\.pps" />
                <data android:pathPattern=".*\\.dps" />
                <data android:pathPattern=".*\\.dpt" />
                <data android:pathPattern=".*\\.pptx" />
                <data android:pathPattern=".*\\.potx" />
                <data android:pathPattern=".*\\.ppsx" />
                <data android:pathPattern=".*\\.doc" />
                <data android:pathPattern=".*\\.dot" />
                <data android:pathPattern=".*\\.wps" />
                <data android:pathPattern=".*\\.wpt" />
                <data android:pathPattern=".*\\.docx" />
                <data android:pathPattern=".*\\.dotx" />
                <data android:pathPattern=".*\\.xls" />
                <data android:pathPattern=".*\\.xlt" />
                <data android:pathPattern=".*\\.et" />
                <data android:pathPattern=".*\\.ett" />
                <data android:pathPattern=".*\\.xlsx" />
                <data android:pathPattern=".*\\.xltx" />
                <data android:pathPattern=".*\\.csv" />
                <data android:pathPattern=".*\\.pdf" />
            </intent-filter>
franc
Senior Member
Senior Member
Posts: 259
Joined: 2005-10-27, 14:09 UTC

Post by *franc »

@ghisler:

Und es ist doch nicht eindeutig. Die App "Locus Pro", die keine Dateiverknüpfungen unbekannter Dateien vornimmt, hat folgenden <intent-filter>:

Code: Select all

<intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:mimeType="application/gpx" />
                <data android:scheme="file" />
                <data android:scheme="content" />
                <data android:pathPattern=".*\\.gpx" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:mimeType="text/xml" />
                <data android:scheme="file" />
                <data android:scheme="content" />
                <data android:pathPattern=".*\\.gpx" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:mimeType="text/plain" />
                <data android:scheme="file" />
                <data android:scheme="content" />
                <data android:pathPattern=".*\\.gpx" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:mimeType="application/kml" />
                <data android:scheme="file" />
                <data android:scheme="content" />
                <data android:pathPattern=".*\\.kml" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:mimeType="application/vnd.google-earth.kml+xml" />
                <data android:scheme="file" />
                <data android:scheme="content" />
                <data android:pathPattern=".*\\.kml" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:mimeType="text/xml" />
                <data android:scheme="file" />
                <data android:scheme="content" />
                <data android:pathPattern=".*\\.kml" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:mimeType="text/plain" />
                <data android:scheme="file" />
                <data android:scheme="content" />
                <data android:pathPattern=".*\\.kml" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:mimeType="application/kmz" />
                <data android:scheme="file" />
                <data android:scheme="content" />
                <data android:pathPattern=".*\\.kmz" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:mimeType="application/vnd.google-earth.kmz" />
                <data android:scheme="file" />
                <data android:scheme="content" />
                <data android:pathPattern=".*\\.kmz" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:mimeType="application/zip" />
                <data android:scheme="file" />
                <data android:scheme="content" />
                <data android:pathPattern=".*\\.zip" />
            </intent-filter>
Wenn man den so anschaut, dürfte das nach ihrer Erklärung dazu führen, dass alle Dateien mit der App verknüpft werden, weil in den data-elementen bei jeder Verwendung von pathPattern kein host dabei steht.

Tun sie aber nicht.

Und auch der Adobe Reader, der in Version 10.1.1 nicht mehr alle Dateien öffnen will, hat gar kein host-Attribut:

Code: Select all

<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.DEFAULT" />
                <data android:scheme="file" android:pathPattern=".*\\.pdf" />
            </intent-filter>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="application/pdf" />
</intent-filter>
Ich frage daher nochmal:

Wo genau fehlt denn nun in den genannten intent-filter / data Elementen das sagenhafte host-Attribut und warum brauchen es Locus Pro und Adobe Reader nicht und funktionieren dennoch?
Dass das fehlende host-Attribut im data-Element zur Verknüpfung mit allen Dateitypen führt ist ja eine Interpretation und steht so nicht dort.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48097
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Doch, ist es - die obigen Filter würden auch auf alle Dateiendungen zutreffen, aber sie enthalten zusätzlich das Feld android:mimeType. Dieses schränkt die Verknüpfung auf den MIME-Typ ein, deshalb gibt es kein Problem.
Author of Total Commander
https://www.ghisler.com
franc
Senior Member
Senior Member
Posts: 259
Joined: 2005-10-27, 14:09 UTC

Post by *franc »

@ghisler: Nun hat der gutmütige Entwickler von Moon+ Reader tatsächlich die von mir vorgeschlagene (und von ihnen abgesegnete) Änderung des intent-filter übernommen (Post am Do März 22, 2012 8:59 am) und damit eine Testversion kompiliert, die er mir geschickt hat und der "Verknüpfungsfehler" besteht nach wie vor.

So ist jetzt in der AndroidManifest.xml zu lesen:

Code: Select all

<intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <data android:mimeType="text/*" />
                <data android:mimeType="image/*" />
                <data android:mimeType="application/epub+zip" />
                <data android:mimeType="application/octet-stream" />
</intent-filter>
<intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="http" android:host="*" />
                <data android:scheme="file" android:host="*" android:pathPattern=".*\\.epub" />
                <data android:scheme="file" android:host="*" android:pathPattern=".*\\.fb2" />
                <data android:scheme="file" android:host="*" android:pathPattern=".*\\.txt" />
</intent-filter>
Nun ist in jedem Data Element mit path Attribut ein Host Attribut, aber immer noch will jede Datei mit dem moon Reader geöffnet werden.
Was also nun?
Gibt es denn keine Vorlagen wie man das nun tatsächlich richtig macht?
Es kann doch nicht sein dass diese Frage von allen Entwicklern durch Stochern im Trüben "gelöst" wird aber keiner die GENAUE Lösung kennt.

@ghisler: was ist denn ihres Erachtens nun hier noch GENAU falsch?
Wie musste es denn ihrer Meinung nach RICHTIG heißen?
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48097
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Doch, genau so müsste es aussehen - sind das wirklich alle Intent-Filter?

Allerdings spielt das überhaupt keine Rolle mehr, weil ich in der aktuellen Version RC5 die Verknüpfung nach Dateiendungen komplett abgeschaltet habe - es wird nun nur noch nach MIME-Typen (android:mimeType) gesucht, wie das die meisten anderen Dateimanager machen. Bitte mal die RC5 probieren!
Author of Total Commander
https://www.ghisler.com
franc
Senior Member
Senior Member
Posts: 259
Joined: 2005-10-27, 14:09 UTC

Post by *franc »

ghisler(Author) wrote:Doch, genau so müsste es aussehen - sind das wirklich alle Intent-Filter?...
Aber ich habe doch die komplette AndroidManifest.xml wie sie im Einsatz ist, in meinem Post vom Montag 19. März 2012 um 9:17 bereits gezeigt!

Aber da es ja nun wohl seitens des Total Commanders mit der rc5 geändert wurde ist es nun müßig herauszufinden, ob letztlich der MoonReader oder der Total Commander den Bug hatte.

Ich installiere also jetzt die rc5 und vergesse das Thema...
...bis ich selbst mal eine App baue ;)

... Tatsächlich, mit rc5 keine sonderbaren Verknüpfungen mehr zum Moonreader usw.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48097
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Aber ich habe doch die komplette AndroidManifest.xml wie sie im Einsatz ist, in meinem Post vom Montag 19. März 2012 um 9:17 bereits gezeigt!
Ja, aber nicht die korrigierte...
Author of Total Commander
https://www.ghisler.com
franc
Senior Member
Senior Member
Posts: 259
Joined: 2005-10-27, 14:09 UTC

Post by *franc »

ghisler(Author) wrote:Ja, aber nicht die korrigierte...
Moment.
Sie fragen: "sind das wirklich alle Intent-Filter?" ich antworte, dass ich die übrigen Intent-Filter in meinem Post vom 22.03.2012 in der zitierten AndroidManifest.xml schon gepostet hatte.

Reden wir aneinander vorbei?

Natürlich habe ich damals nicht die "korrigierte" Version gepostet, sondern diejenige, die der Entwickler im Einsatz hatte.
Diejenigen Intent-Filter, die die AndroidManifest.xml zusätzlich noch enthält, kann man ja leicht ablesen.
Dennoch hier nochmal alle intent-filter zur Ansicht, mit diesen ist das Problem noch präsent (in tc-rc4):

Code: Select all

...
<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.DEFAULT" />
             <data android:mimeType="text/*" />
             <data android:mimeType="image/*" />
             <data android:mimeType="application/epub+zip" />
             <data android:mimeType="application/octet-stream" />
</intent-filter>
<intent-filter>
             <action android:name="android.intent.action.VIEW" />
             <category android:name="android.intent.category.DEFAULT" />
             <category android:name="android.intent.category.BROWSABLE" />
             <data android:scheme="http" android:host="*" />
             <data android:scheme="file" android:host="*" android:pathPattern=".*\\.epub" />
             <data android:scheme="file" android:host="*" android:pathPattern=".*\\.fb2" />
             <data android:scheme="file" android:host="*" android:pathPattern=".*\\.txt" />
</intent-filter>
...
<intent-filter>
	<action android:name="com.flyersoft.moonreaderp.open_broadcast" />
</intent-filter>
...
<intent-filter>
    <action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
...
<intent-filter>
    <data android:scheme="db-x652cgcle79aei8" />
    <action android:name="android.intent.action.VIEW" />
    <category android:name="android.intent.category.BROWSABLE" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>
...
PS.: übrigens habe ich mal die alte Adobe Reader AndroidManifest.xml ausgegraben, bei der ich damals dieses Problem zuerst entdeckt hatte (Ausgangsthread). In der aktuellen AR Version (mit tc rc4) ist es ja nicht mehr.
Verblüffend: die beiden Dateien sind fast identisch, und völlig gleich, was die Intent-Filter anbetrifft.
Es hat wohl mindestens hier nichts damit zu tun gehabt und wohl eher mit rc3->rc4
Post Reply