question

RajuGadda-8585 avatar image
0 Votes"
RajuGadda-8585 asked JarvanZhang-MSFT commented

Facing FCM token issue in Release mode using Xamarin forms with C#

Hello Guys ... I am facing issue a with this module. I have everything in place and it is working when I built the debug apk of the app or when I build it in the android emulator or in a physical device and the token is generating fine ... but when I build a release apk the FCM_ token stops generating. I have tried everything and can't seem to find the issue ... What could be wrong here ?

This is my code to generate the FCM token in MyFirebseIIDService.cs:

     public override void OnTokenRefresh()
     {
         NewToken = FirebaseInstanceId.Instance.Token;
         Xamarin.Forms.Application.Current.Properties["SaveNewToken"] = NewToken;
         Xamarin.Forms.Application.Current.SavePropertiesAsync();
         // SendRegistrationToServer(NewToken);
           
     }

dotnet-csharpdotnet-xamarin
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi, RajuGadda-8585. What the link option do you select in release? The code of assembly may be removed in release. Try to add the related line code in the proguard.config file to keep the class like below.

-keep class com.google.firebase.** { *; }
0 Votes 0 ·

0 Answers