Skip to content

Latest commit

 

History

History
103 lines (70 loc) · 4.56 KB

File metadata and controls

103 lines (70 loc) · 4.56 KB

FAQ

Android

  1. Getting java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process {your_package_name}. Make sure the google-services.json has the GoogleServicesJson build action. If you have that set, then clean and build again, this is a known issue when using Firebase Component. More info and fix here: https://bugzilla.xamarin.com/show_bug.cgi?id=56108.

Workaround 1

Add the following to the android project .csproj file:

   <Target Name="RemoveGoogleServicesJsonStampFiles" BeforeTargets="BeforeBuild">
    <Delete Files="$(IntermediateOutputPath)\ProcessGoogleServicesJson.stamp" />
   </Target>

Workaround 2

Add the following call:

   var options = new FirebaseOptions.Builder()
		.SetApplicationId("")
		.SetApiKey("")
		.SetDatabaseUrl("https://*.firebaseio.com")
		.SetStorageBucket("*.appspot.com")
		.SetGcmSenderId("").Build();
    this.firebaseApp = FirebaseApp.InitializeApp(this, options);

Before:

    FirebasePushNotificationManager.Initialize(this, true);

Workaround 3

Install Xamarin.GooglePlayServices.Basement v60.1142.0-rc1 on Android

References:

https://forums.xamarin.com/discussion/comment/308465/#Comment_308465

https://bugzilla.xamarin.com/show_bug.cgi?id=56108

CrossGeeks#67

  1. Android initialization should be done on and Android Application class to be able to handle received notifications when application is closed. Since no activity exist when application is closed.

  2. You won't receive any push notifications if application is stopped while debugging, should reopen and close again for notifications to work when app closed. This is due to the application being on an unstable state when stopped while debugging.

  3. On some phones android background services might be blocked by some application. This is the case of ASUS Zenfone 3 that has an Auto-start manager, which disables background services by default. You need to make sure that your push notification service is not being blocked by some application like this one, since you won't receive push notifications when app is closed if so.

  4. Must compile against 26+ as plugin is using API 26 specific things. Here is a great breakdown: http://redth.codes/such-android-api-levels-much-confuse-wow/ (Android project must be compiled using 8.0+ target framework)

  5. The package name of your Android aplication must start with lower case or you will get the build error: Installation error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED

  6. Make sure you have updated your Android SDK Manager libraries:

image

  1. Topics are case sensitive so "test" and "Test" are different topics.

  2. Error 1589 NotificationService Not posting notification without small icon
    It happen when the message is received, but the notification isn't displayed. If you got this error, it mean you need to tell which one is your app icon on Android Project Properties > Android Manifest > application Icon or in the AndroidManifext.xml file and put android:icon="@drawable/{replace with your icon file name}" in the

	<application android:label="Test" android:icon="@drawable/{replace with your icon file name}">	
	...
	</application>
  1. Not getting push notifications on Release but on Debug yes? Uninstall the debug version or increment the build number before making the release build.

iOS

  1. When subscribing to topics getting error: Failed to subscribe to topic Error Domain=com.google.fcm Code=5 "(null)"

Add this to your Info.plist:

<key>CFBundleURLTypes</key>
<array>
		<dict>
			<key>CFBundleTypeRole</key>
			<string>Editor</string>
			<key>CFBundleURLSchemes</key>
			<array>
				<string>com.google.fcm</string>
			</array>
		</dict>
</array>

Some references:

https://stackoverflow.com/questions/37549717/cannot-receive-push-notification-on-ios-from-firebase-3-2-0-topics https://stackoverflow.com/questions/37711082/how-to-handle-notification-when-app-in-background-in-firebase https://stackoverflow.com/questions/41102932/updating-firebase-push-notification-when-app-is-in-background xamarin/GooglePlayServicesComponents#20 https://stackoverflow.com/questions/42158239/getting-exception-using-firebase-in-xamarin-android/42159446#42159446 https://stackoverflow.com/questions/37372806/firebase-cloud-messaging-and-multiple-topic-subscription-from-ios-fails