Intercom not working on android 12 Xamarin forms

278 Views Asked by At

io.intercom.android.sdk.fcm.IntercomFcmMessengerService: Targeting S+ (version 31 and above) requires that an explicit value for android:exported be defined when intent filters are present]

I know I have to add something in the manifest similar to this but still not finding it

 <receiver android:name="" android:exported="false">
      <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
      </intent-filter>
 </receiver>
1

There are 1 best solutions below

0
Jessie Zhang -MSFT On

In Android 11 and lower, when declaring an Activity, Service, or Broadcast receiver in AndroidManifest, you did not explicitly declare android:exported. Since the default value is exported=true, you only need to declare exported=false when you do not want to disclose to the outside.

For example:

 <activity android:name="com.example.app.backgroundService">
    <intent-filter>
        <action android:name="com.example.app.START_BACKGROUND" />
    </intent-filter>
 </activity>

Android 12 Changes: Explicit declaration of exported Apps that set SDK API 31 (android 12) as Target sdk on Android 12 devices must explicitly declare exported in components such as Activity that declared intent-filter.

For example,you must explicitly declare exported as follows:

  <service android:name="com.example.app.backgroundService"
         android:exported="false">
    <intent-filter>
        <action android:name="com.example.app.START_BACKGROUND" />
    </intent-filter>
 </service>

In a word, android:exported="true" or "android:exported="false" must be added to all receivers, services, and activity tags with intent-filters inside them.

Note:

You can find the AndroidManifest.xml in folder obj of your app. My Folder is MyAndroidProject\obj\Debug\120\.

After finding file AndroidManifest.xml, you can recheck if you have added tag android:exported to all of your receivers, services, and activity.