Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not receiving DeviceToken on Release mode #409

Open
nk-alex opened this issue Feb 10, 2025 · 0 comments
Open

Not receiving DeviceToken on Release mode #409

nk-alex opened this issue Feb 10, 2025 · 0 comments

Comments

@nk-alex
Copy link

nk-alex commented Feb 10, 2025

I'm using .net8.0-android for this.

This is my setup:

.cproj

	<ItemGroup Condition="'$(TargetFramework)' == 'net8.0-android'">
		<GoogleServicesJson Include="Platforms\Android\PushNotifications\google-services.json" />
		<PackageReference Include="Plugin.Firebase" Version="3.1.3" />
	</ItemGroup>

AndroidManifest.xml

<application android:allowBackup="false" android:fullBackupContent="false" android:supportsRtl="true" android:label="MyApp" android:icon="@mipmap/ic_launcher">
	<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdInternalReceiver" android:exported="false" />
	<receiver android:name="com.google.firebase.iid.FirebaseInstanceIdReceiver" android:exported="true" android:permission="com.google.android.c2dm.permission.SEND">
		<intent-filter>
			<action android:name="com.google.android.c2dm.intent.RECEIVE" />
			<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
			<category android:name="io.myapp.com" />
		</intent-filter>
	</receiver>
</application>

Service

[Service(Exported = false)]
[IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" })]
public class MyFirebaseMessagingService : FirebaseMessagingService
{
	public override void OnNewToken(string p0)
	{
		var deviceToken = p0;
	}
}

This setup is working on Debug mode. But when I compile using Release mode, OnNewToken never gets called. Even if I uninstall & reinstall my application.

By searching the internet I found out I had to add my SHA-1 release certificate to my firebase console (which I did) and download the updated google-services.json.

But that doesn't solve my issue either. What am I missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant