To replicate: Open example, change targetSdkVersion to 31 (or 32) in build.gradle, make the necessary changes in AndroidManifest, and build.
You will have to make these minor adjustments in AndroidManifest
Under "<activity
android:exported="true"
And make this the intent-filter
<receiver
android:name="flutter.moum.headset_event.HeadsetBroadcastReceiver"
android:exported="true" >
<intent-filter>
<action android:name="android.intent.action.HEADSET_PLUG" />
<action android:name="android.intent.action.MEDIA_BUTTON" />
</intent-filter>
</receiver>
This will allow you to successfully build the release onto your device. However, the listener does not work at all. It simply does not respond to bluetooth connect/disconnect events. Setting TargetSdkVersion to 30, even while keeping the above manifest changes, fixes the problem entirely. This is on an Android 12 device.
To replicate: Open example, change targetSdkVersion to 31 (or 32) in build.gradle, make the necessary changes in AndroidManifest, and build.
You will have to make these minor adjustments in AndroidManifest
Under "<activity
android:exported="true"And make this the intent-filter
This will allow you to successfully build the release onto your device. However, the listener does not work at all. It simply does not respond to bluetooth connect/disconnect events. Setting TargetSdkVersion to 30, even while keeping the above manifest changes, fixes the problem entirely. This is on an Android 12 device.