Hello, I've been trying to get my Xamarin Forms app to enable Badge Icon on notifications in my Xiaomi devices.
When I get a Firebase notification IF I HAVE ENABLED the badge icon notification I can see the notification number in the app icon in the Launcher.
To enable it I have to go to:
Once, that option is enabled I can see the number with the notification count in the launcher.
My question is how can I enable it by code?
For example, the Whatsapp app already had it enabled when I installed it, I didn't have to go enable it manually.
So there's a way of actually enabling it, but I can't find any documentation or anything.
I've dissasembled the Whatsapp app and the only thing I've found interesting was this class:
package X; import android.app.Notification; import android.content.Context; import android.os.Build; import com.whatsapp.util.Log; /* renamed from: X.2MW reason: invalid class name */ public final class AnonymousClass2MW extends C34431jX { public void A03(Context context, Notification notification, int i) { if (Build.VERSION.SDK_INT >= 19 && Build.MANUFACTURER.equalsIgnoreCase("Xiaomi")) { try { Object obj = notification.getClass().getDeclaredField("extraNotification").get(notification); obj.getClass().getDeclaredMethod("setMessageCount", new Class[]{Integer.TYPE}).invoke(obj, new Object[]{Integer.valueOf(i)}); } catch (Exception unused) { Log.e("Could not set badge for Xiaomi notification"); } } } }
But I couldn't make it work in Xamarin. It doesn't give an error but it seems like that is only changing the number, not allowing/enabling the badge icon option.
Any help would be appreciated.
Thank You.