I am trying to act on downloading of a .XM file using the following link.
http://api.modarchive.org/downloads.php?moduleid=50479#ngs_cvrg.xm
Here is a snippet from my manifest:
<application
<activity
...
<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" />
<action android:name="android.intent.action.EDIT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/octet-stream" />
<data android:host="*" />
<data android:pathPattern=".*\\.xm" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<action android:name="android.intent.action.EDIT" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="application/mytestapp" />
<data android:host="*" />
<data android:pathPattern=".*\\.xm" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="file" />
<data android:pathPattern=".*\\.xm" />
<data android:host="*" />
<data android:mimeType="text/plain"/>
</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" />
<data android:mimeType="*/*" />
<data android:pathPattern=".*\\.xm" />
<data android:host="*" />
</intent-filter>
</activity>
Below is a snippet of my code which is not being called:
@Override
protected void onCreate( Bundle savedInstanceState )
{
CheckForBrowserActivation();
}
public void CheckForBrowserActivation()
{
Intent intent = getIntent();
String sData = intent.getDataString();
ContextActivity.LogDebugf( "Intent [%s] Data[%s]\n", intent.getAction(), sData );
if( Intent.ACTION_VIEW.equals( intent.getAction() ) )
{
ContextActivity.LogDebugf( "BROWSER, ACTION_VIEW\n" );
Can somebody please tell me why the Intent filter is not working for this link?
I have successfully had the same code and type of intent filter working for m3u playlists etc.
UPDATE:
I'm trying to receive any application/octet-stream links now and I just cannot get my app to receive these intents with that link. I have tried both "http" and "file" schemes but neither work. I have removed all intent filters so I now only have one (see below). Why won't this work?
<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" />
<data android:host="*" />
<data android:mimeType="application/octet-stream" />
</intent-filter>
http://api.modarchive.org/downloads.php?moduleid=50479#ngs_cvrg.xm
The file extension of this URL is .php
.
<data android:pathPattern=".*\\.xm" />
The file extension of this pathPattern
is .xm
. This does not match your URL.