Android Question Explicit Value for export intent??

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Sorry to be so dumb; but am lost by what this is asking of me

In my Music Program I've always had this code to allow handling the play/pause for playing on Bluetooth devices:
B4X:
AddApplicationText(<receiver android:name="smymediabrowserservice$MyReceiver">
                        <intent-filter android:priority="2147483647" >
                            <action android:name="com.google.android.gms.car.media.STATUS" />
                            <action android:name="android.intent.action.MEDIA_BUTTON" />                            
                            <action android:name="com.sec.android.app.music.musicservicecommand.play"/>
                            <action android:name="com.sec.android.app.music.musicservicecommand.pause"/>
                            <action android:name="com.sec.android.app.music.musicservicecommand.playprevious"/>
                            <action android:name="com.sec.android.app.music.musicservicecommand.playnext"/>                            
                      </intent-filter>
                    </receiver>)

Moving my SDK to 33 (I'm trying to get my Music Program to work on Android Auto) I get this error and don't understand how to fix it:
B4X:
Installing file to device.    Error
adb: failed to install MusicDB.apk: Failure [INSTALL_PARSE_FAILED_MANIFEST_MALFORMED: Failed parse during installPackageLI: /data/app/vmdl1602819560.tmp/base.apk (at Binary XML file line #71): com.BOBs.MusicDB.smymediabrowserservice$MyReceiver: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present]

I know it wants something to be defined, I'm assuming as exported but how, what and where

Thanks for any help
 

drgottjr

Expert
Licensed User
Longtime User
i think it goes like this at line 1: AddApplicationText(<receiver android:name="smymediabrowserservice$MyReceiver" export="true">

true : broadcast receiver can receive events sent by same or other applications
false‍ : broadcast receiver can receive events sent by same application

my understanding was that b4a 12 dealt with this. if you're targeting sdk 33, i'm guessing you're using 12, so i don't know what the problem is.
although, according to my notes (copied from some of @Erel's comments,
1. You shouldn't add your own activities with AddApplicationText. You should instead use AddActivityText to add a node inside the activity.
2. The android:exported attribute is an activity/service/receiver attribute. Don't add it to the action node. Do add it to the activity.

i see you're using AddApplicationText. perhaps you might need to change it to AddActivityText
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
well converted to this:
B4X:
AddActivityText(smymediabrowserservice, 
                <intent-filter>
                <action android:name="com.google.android.gms.car.media.STATUS" />
                <action android:name="android.intent.action.MEDIA_BUTTON" />
                <action android:name="com.sec.android.app.music.musicservicecommand.play" />                
                <action android:name="com.sec.android.app.music.musicservicecommand.pause" />                
                <action android:name="com.sec.android.app.music.musicservicecommand.playprevious" />                
                <action android:name="com.sec.android.app.music.musicservicecommand.playnext" />                                
                </intent-filter>)

Not sure if I need the $MyReceiver at the end of the service name
 
Upvote 0
Top