Android Question Intent for playing video?

Troberg

Well-Known Member
Licensed User
I've made a video player (https://play.google.com/store/apps/details?id=com.troberg.svpfull). Now, I want it to appear as a selectable alternative when the user selects a video file in a file manager.

In other words, I need to respond to the correct intent.

After googling around and seeing many variants and tried them all, I still don't get the desired effect. My app does not show up in the list of player apps.

What I have at the moment:

Manifest:

B4X:
AddReceiverText(PlayIntent,
<intent-filter>
    <action android:name="android.intent.action.VIEW"/>
    <data android:mimeType="video/*"/>
</intent-filter>)
Service (left as default, except for this):

B4X:
Sub Service_Start (StartingIntent As Intent)
    Log(StartingIntent.Action)
    Log(StartingIntent.ExtrasToString)
End Sub
As you can see, about as bare bones as it gets. What am I missing?
 

Troberg

Well-Known Member
Licensed User
OK, now I see where the problem is, but I can't understand it. If I change the first line from

AddActivityText(PlayIntent,

to

AddActivityText(Main,

It will show up and launch, but then, as Main is my main activity, it won't get the intent data. Why won't it work when I use the PlayIntent service?

It worked for me when intercepting SMS messages...
 

Troberg

Well-Known Member
Licensed User
I'll try to make the problem clear (all differences in first line of each snippet):

Doesn't work:
B4X:
AddReceiverText(PlayIntent,
<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <data android:mimeType="video/*"/>
</intent-filter>)
Doesn't work (gives "Module: main_br not found."):
B4X:
AddReceiverText(Main,
<intent-filter>
     <action android:name="android.intent.action.VIEW" />
     <data android:mimeType="video/*"/>
</intent-filter>)
Works, but launches the activity instead:
B4X:
AddActivityText(Main,
<intent-filter>
    <action android:name="android.intent.action.VIEW" />
    <data android:mimeType="video/*"/>
</intent-filter>)
Works in my SMS intercepting application:
B4X:
AddReceiverText(SMSListener,
<intent-filter>
    <action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>)
As far as I can see, the first non-working code is equivalent to the working code from my SMS app, and should work. What is the obvious thing I'm missing???
 

Troberg

Well-Known Member
Licensed User
Now, I've more or less given up on this approach and launch Main instead, using StartingIntent to catch the intent data. Is there any drawbacks to this approach?
 
Top