Giter Club home page Giter Club logo

firebasepushnotificationplugin's Introduction

Firebase Push Notification Plugin for Xamarin iOS and Android

Simple cross platform plugin for handling firebase push notifications.

Build Status

Setup

Platform Support

Platform Version
Xamarin.iOS iOS 8+
Xamarin.Android API 15+

API Usage

Call CrossFirebasePushNotification.Current from any project to gain access to APIs.

Features

  • Receive firebase push notifications
  • Subscribing/Unsubcribing to topics
  • Support for push notification category actions
  • Customize push notifications
  • Localization

     

Documentation

Here you will find detailed documentation on setting up and using the Firebase Push Notification Plugin for Xamarin

Contributors

firebasepushnotificationplugin's People

Contributors

alleschonweg avatar charlienguyen409 avatar giorgi avatar hemantbeast avatar jtorvald avatar maikschott avatar martijn00 avatar rdelrosario avatar rohitvipin avatar themronion avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

firebasepushnotificationplugin's Issues

iOS can receive push notifications created in Firebase console but not topics

Version Number of Plugin: 1.0.7
Device Tested On: Apple iPhone SE
Simulator Tested On: Push notifications don't work on simulator
Version of VS: 2017 enterprise
Version of Xamarin: 2.3.4

I did next steps:

  • download your project from https://github.com/CrossGeeks/FirebasePushNotificationPlugin
  • extracted only FirebasePushSample
  • reinstall missing nuget packages (package manager consoole: Update-Package -reinstall)
  • run FirebasePushSample.sln solution
  • opened FirebasePushSample.iOS
    Edited Entitlements.plist file with next content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>aps-environment</key>
	<string>development</string>
</dict>
</plist>
  • downloaded GoogleService-Info.plist from my Firebase-Push mobile apps iOS project and copied to project's root (just changed the content of the file).
  • I'm running mac os in vmware player, therefore started te mac os, plugged in to usb apple iPhone and build FirebasePushSample.iOS project

If I send message through Firebase console, iPhone receives and displays notification.
Send message through firebase console

Note: it only works if option Target is set to User segment

What have I missed? I subscribe to topis general in App.xaml.cs

namespace FirebasePushSample
{
  public partial class App : Application
  {
    public App()
    {
      InitializeComponent();
      MainPage = new FirebasePushSample.MainPage();
    }

    protected override void OnStart()
    {
      // Handle when your app starts
      CrossFirebasePushNotification.Current.Subscribe("general");
      ...
    }
  }
}

Output log:

2017-10-06 12:19:43.550: <FIRInstanceID/WARNING> Firebase messaging not setup correctly, nil senderID.
2017-10-06 12:19:43.559 FirebasePushSample.iOS[1013:470213] refreshPreferences: HangTracerEnabled: 0
2017-10-06 12:19:43.559 FirebasePushSample.iOS[1013:470213] refreshPreferences: HangTracerDuration: 500
2017-10-06 12:19:43.559 FirebasePushSample.iOS[1013:470213] refreshPreferences: ActivationLoggingEnabled: 0 ActivationLoggingTaskedOffByDA:0
2017-10-06 12:19:43.583: <FIRInstanceID/WARNING> Failed to fetch APNS token Error Domain=com.firebase.iid Code=1001 "(null)"
2017-10-06 12:19:43.595: <FIRInstanceID/WARNING> APNS Environment in profile: development
2017-10-06 12:19:43.597 FirebasePushSample.iOS[1013:] <FIRAnalytics/INFO> Firebase Analytics v.3600000 started
2017-10-06 12:19:43.597 FirebasePushSample.iOS[1013:] <FIRAnalytics/INFO> To enable debug logging set the following application argument: -FIRAnalyticsDebugEnabled (see http://goo.gl/Y0Yjwu)
2017-10-06 12:19:43.611 FirebasePushSample.iOS[1013:] <FIRAnalytics/INFO> Firebase Analytics enabled
[0:] Received
2017-10-06 12:21:39.458 FirebasePushSample.iOS[1013:470213] {
    aps =     {
        alert =         {
            body = test4;
            title = test;
        };
    };
    body = test;
    "gcm.message_id" = "0:1507285298794200%fcf8646bfcf8646b";
    "gcm.n.e" = 1;
    "google.c.a.c_id" = 7748626265223536540;
    "google.c.a.c_l" = test6;
    "google.c.a.e" = 1;
    "google.c.a.ts" = 1507285298;
    "google.c.a.udt" = 0;
}

OnNotificationOpened never executed.

device : android 6
plugin.firebasepushnotification : 1.0.7-beta

Hello I have a problem with OnNotificationOpened .

i successfully send and receive notification message , i added in main activity

protected override void OnNewIntent(Intent intent)
    {
        FirebasePushNotificationManager.ProcessIntent(intent);
        base.OnNewIntent(intent);
    }

but nothing has been change.

IOS: FCM notification not working with Release mode

Hello,

We are using this plugin for xamarin forms And we successfully tested android Ad-Hoc apk.
For iPhone we are able to get notification in debug mode but in release/ production mode its not working, we are not getting any notifications.

We added APNs authentication key (.p8) in firebase console project.
also followed every step given in Getting started.

We used FirebaseNet.Messaging nuget package to send data and also tested with Postman

We also added Apple Push Notification service SSL Certificate and Production SSL Certificate.
We set Background modes : Remote notification checked.
And FirebaseAppDelegateProxyEnabled to No in Info.plist.

The Json we are sending:

{
   "to": "/topics/TSCG230_XXXXX2",
   "priority" : "high",
      "notification": {
    "body": "Hello",
    "title": "This is test message.",
    "content_available" : true,
    "sound": "Alarm.wav"
   },
   "data": {
        "title" : "TSCG230_XXXXX2",
        "infoType" : "LEL#",
        "body" : "00100",
        "notiType" : "Alarm"
     }
}

Version Number of Plugin: v1.0.4
Device Tested On: iPhone 4s
Simulator Tested On: -
Version of VS: VS2017 Community
Version of Xamarin: latest stable

Steps to reproduce the Behavior

Create ipa file and test on iPhone 4s.

Expected Behavior

It should show notification while application is in background as it is showing in debug mode.

Actual Behavior

Its not showing notification while application is in background.

Let me know if any information is needed.
Please help us to figure out the issue.
Thanks.

iOS Local notification won't work

Hi @rdelrosario,

I am implementing local notification with other plugin(Acr.Notification), but for some reason, all local notification on iOS get dragged by the PushNotificationHandler and doesn't work as expected.

I am handling all the push(Android/iOS) via your plugin. but local notification for my app is crucial. Do you have a suggestion how to disable the current behavior on iOS?, Without losing the push notification?

Android is working without problem so far.

push notification not getting received

CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) not getting fired on android and IOS

Bug Information

Version Number of Plugin:1.0.4
Device Tested On:Samsung S5 android 6.0
Simulator Tested On:
Version of VS: visual studio for mac
Version of Xamarin:2.3.4
Versions of other things you are using:

Steps to reproduce the Behavior

Expected Behavior

Actual Behavior

Code snippet

Screenshotst

FireBase Token only generating first time.

I am using the plugin for xamarin forms. I am getting the firebase token first time I launch the app in Debug mode. But after that whenever I debug the application without uninstalling. I don't receive any error.

CrossFirebasePushNotification.Current.Token gives me null every time then it goes for

CrossFirebasePushNotification.Current.OnTokenRefresh += (s, p) => { System.Diagnostics.Debug.WriteLine($"TOKEN : {p.Token}"); App.firebaseRegToken = p.Token; }
And it doesn't come in the event handler.
I have tried even with production environment same thing happens there.
Double checked the certificates on Firebase console also.
Do you have any idea why this could be happening ?

Bug Information

Version Number of Plugin:
Device Tested On: iOS 10.3.1 iPhone 5
Simulator Tested On:
Version of VS: 7.0.1(build 24)
Version of Xamarin: 2.3.4.270
Versions of other things you are using: iOS 10.3.1 iPhone 5

Receiving a System.TypeLoadException: Could not find method due to a type load error in iOS

Hi
I'm not sure if it is an error in the plugin or something I'm missing.
I made your plugin worked in android, but in iOS, i receive this error when running the app

Bug Information

Version Number of Plugin: 1.0.7
Device Tested On: iPhone 6 Plus iOS 11.0
Simulator Tested On: iPhone 6 Plus iOS 11.0
Version of VS: 14.0.25431.01 update 3
Version of Xamarin: 4.7.10.22

Versions of other things you are using:

Microsoft.CSharp 4.4.0
Microsoft.NetCore.Platforms 2.0.0
Microsoft.WIn32.Primitives 4.3.0
NetStandard.Library 2.0.1
Newonsoft.Json 10.0.3
Plugin.Permission 2.1.0
sqlite-net-pcl 1.4.118
sqlitePCL.bundle_green 0.9.3
SQlitePCL.raw 0.9.3
SQlitePCL.raw.bundle_green 1.1.8
SQlitePCLRaw.core 1.1.8
SQLitePCLRaw.provider.sqlite3.ios_unifed 1.1.8
System.AppContext 4.3.0
System.Collections 4.3.0
System.Collections.Concurrent 4.3.0
System.ComponenModel.TyoeConverter 4.3.0
System.Console 4.3.0
System.Diagnostics.Debug 4.3.0
System.Diagnostics.Tools 4.3.0
System.Diagnostics.Tracing 4.3.0
System.Globalization 4.3.0
System.Globalization.Calendars 4.3.0
System.IO 4.3.0
System.IO.Compression 4.3.0
System.IO.Compression.Zipfile 4.3.0
System.IO.FileSystem 4.3.0
System.IO.FileSystem.Primitives 4.3.0
System.Linq 4.3.0
System.Linq.Expression 4.3.0
System.Net.Http 4.3.3
System.Net.Primitives 4.3.0
System.Net.Sockets 4.3.0
System.ObjectModel 4.3.0
System.Reflection 4.3.0
System.Reflection.Extentions 4.3.0
System.Reflection.Primitives 4.3.0
System.Resources.ResourceManager 4.3.0
System.Runtime 4.3.0
System.Runtime:extentions 4.3.0
System.Runtime.Handles 4.3.0
System.Runtime.InteropServices 4.3.0
System.Runtime.InteropServices.RuntimeInformation 4.3.0
System.Runtime.Numerics 4.3.0
System.Runtime.Serializations.Formatters 4.3.0
System.Runtime.Serializations.Primitives 4.3.0
System.Security.Cryptography.Algorithms 4.3.0
System.Security.Cryptography.Encoding 4.3.0
System.Security.Cryptography.Primitives 4.3.0
System.Security.Cryptography.X509Cerificates 4.3.1
System.ServiceModel.Primitives 4.4.0
System.Text.Encoding 4.3.0
System.TextEncoding.Extensions 4.3.0
System.Text.RegularExpressions 4.3.0
System.Threading 4.3.0
System.Threading.Tasks 4.3.0
System.Threading.Timer 4.3.0
System.Xml.ReaderWriter 4.3.0
System.Xml.XDocument 4.3.0
System.Xml.XmlDocument 4.3.0
Xam.Plugin.GeoLocator 4.1.1
Xam.Plugins.Messaging 4.0.0
Xam.Plugins.Settings 3.1.1
Xamarin.Build.Download 0.4.7
Xamarin.Firebase.iOS.Analytics 4.0.2
Xamarin.Firebase.iOS.InstanceID 2.0.0
Xamarin.Forms 2.4.0.18342
Xamarin.Forms.GoogleMaps 2.1.1
Xamarin.Google.iOS.Maps 2.1.0.2

Steps to reproduce the Behavior

I just follow the steps from your tutorial

Expected Behavior

To receive push notifications

Actual Behavior

When the app is starting it crashes giving an error

Code snippet

In the Main.cs class when executing
UIApplication.Main(args, null, "AppDelegate");

Screenshots

typeloadexception

typeloadexception1

App Reload on Push Notification Click Xamarin Forms

I have implemented push notifications on my app and they work fine. The problem I have is that when I click them in the pull down menu they immediately reload the app. How to fix it?

I am using Xamarin Forms with PCL.

Android null pointer exceptions

Hi,
I have some unexpected app crashes with null pointer exception.

Issue
After building and deploying, the app fully crash after startup phase.
Usually right after the white screen (or splash screen).

In Visual Studio you see
Your app has entered a break state, but there is no code to show because all threads were executing external code (typically system or framework code).
There is no more real usable information to get...

In the debug log you find
... I/FirebaseInitProvider( 2388): FirebaseApp initialization unsuccessful

Workaround Fix
Do a full rebuild of the solution and then it works again...
If the app is running then it keeps running without further issues.

Reproduce
I create a new Xamarin project (pcl) then follow your documentation. Build run everything works fine.
Add / change resources in android project and just hit run. most of the time app crashes.
I use newest VS, Xamarin, Forms, normal and beta version of you plugin (used for IOS).
Android Devices: Emulator, Sony, Samsung, Nokia 8...

Additional Infos
I figured out it seems only happen if i change something in the resource structure (change a property, add/remove files or just change text in the styles files):
Then the next build/deploy app will crash until you rebuild the complete solution.
Hope it helps you do some more exception handling pointing out why initialization unsuccessful. And hopefully help dealing with resource changes.

Receive notification when app is closed but method OnNotificationReceived not working

I am using this for my Xamarin.Forms application but its not handeling the CrossFirebasePushNotification.Current.OnNotificationReceived method in the Android project. I can receive a notification if the application is killed but its not handeling the method. What do I wrong?

[Application]
    public class MainApplication : Application
    {

        int badgeCount = 0;

        public MainApplication(IntPtr handle, JniHandleOwnership transer) : base(handle, transer)
        {
        }

        public override void OnCreate()
        {
            base.OnCreate();
            try
            {
                FirebasePushNotificationManager.Initialize(this, new NotificationUserCategory[]
                {
                        new NotificationUserCategory("message",new List<NotificationUserAction> {
                        new NotificationUserAction("Reply","Reply",NotificationActionType.Foreground),
                        new NotificationUserAction("Forward","Forward",NotificationActionType.Foreground)
                    }),
                        new NotificationUserCategory("request",new List<NotificationUserAction> {
                        new NotificationUserAction("Accept","Accept",NotificationActionType.Default,"check"),
                        new NotificationUserAction("Reject","Reject",NotificationActionType.Default,"cancel")
                    })
                }, false);

                CrossFirebasePushNotification.Current.OnTokenRefresh += (s, p) =>
                {
                    App.token = p.Token;
                    Console.WriteLine(p.Token);
                };

                CrossFirebasePushNotification.Current.Subscribe("news");

                App.token = CrossFirebasePushNotification.Current.Token;

                ME.Leolin.Shortcutbadger.ShortcutBadger.ApplyCount(this, 0);

                //Handle notification when app is closed here
                CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) =>
                {
                    badgeCount++;
                    ME.Leolin.Shortcutbadger.ShortcutBadger.ApplyCount(this, badgeCount);
                    var message = p.Data;
                    var test = s;

                    try
                    {
                        Task.Run(() => ViewModelLocator.MainChatViewModel.InitializeChatAsync()).Wait();
                    }
                    catch (Exception) { }
                };

                CrossFirebasePushNotification.Current.OnNotificationOpened += (s, p) =>
                {
                    badgeCount = 0;
                    ME.Leolin.Shortcutbadger.ShortcutBadger.ApplyCount(this, badgeCount);
                    try
                    {
                        Task.Run(() => ViewModelLocator.MainChatViewModel.InitializeChatAsync()).Wait();
                    }
                    catch (Exception) { }
                };
            }
            catch (Exception)
            {

            }
        }
    }

Notification click not working when application is in background/killed

First of all, great plugin and nice work !

When my application is in background or killed, i receive the notification, but when i click on it in the notification drawer, nothing happen. I did as you suggested, initialized the manager in the Application OnCreate(). The OnNotificationReceived in the application is not fired when the app is killed.
I tried to specify a click_action on the notification and add a filter in the manifest but it doesn't work.

Do you have an idea how to open the app, so i can handle the action properly ?

OnTokenRefresh not fired on IOS

If you are creating an issue for a BUG please fill out this information. If you are asking a question or requesting a feature you can delete the sections below.

Failure to fill out this information will result in this issue being closed. If you post a full stack trace in a bug it will be closed, please post it to http://gist.github.com and then post the link here.

Bug Information

Version Number of Plugin:
Device Tested On: Iphone 5 + iphone 7s
Simulator Tested On:
Version of VS: visual studio 2017 and Visual studio for mac
Version of Xamarin:
Versions of other things you are using:

Steps to reproduce the Behavior

Expected Behavior

Actual Behavior

Code snippet

Screenshots

Java NoSuchMethodError getSerial() upon application startup

Greetings,

I'm seeing Java NoSuchMethodError exceptions upon starting my Xamarin.Android application when using this plugin.

Bug Information

Version Number of Plugin: 1.0.4
Device Tested On: Samsung Galaxy Note running 4.4 and also on Pixel running 7
Simulator Tested On:
Version of VS: VS Mac 7.1.5
Version of Xamarin: Xamarin.Android 7.4.5.1
Versions of other things you are using:
HockeyApp

Steps to reproduce the Behavior

Deploy a new release version of the app, and restart it.

Expected Behavior

Release App start up without crashing

Actual Behavior

App crashes upon initial startup, subsequent runs work, but crash info is uploaded to HockeyApp. I can provide the stack traces if needed. Unfortunately, I've not been able to recreate the error in Debug mode.

Code snippet

Screenshots

Xamarin Android - Event does not trigger - OnNotificationReceived & OnNotificationOpened

If you are creating an issue for a BUG please fill out this information. If you are asking a question or requesting a feature you can delete the sections below.

Failure to fill out this information will result in this issue being closed. If you post a full stack trace in a bug it will be closed, please post it to http://gist.github.com and then post the link here.

Bug Information

Version Number of Plugin: 1.0.7
Device Tested On: Moto G5s+
Simulator Tested On:
Version of VS: 2015
Version of Xamarin: 4.7.9.45
Versions of other things you are using:

Steps to reproduce the Behavior

Send Notification from PostMan for OnNotificationReceived event not triggering issue
Click on Notification for OnNotificationOpen event not triggering issue

Expected Behavior

Both event should trigger on respective action

Actual Behavior

Application goes to main activity and event is not fired

I have followed instruction given at below urls,
https://github.com/CrossGeeks/FirebasePushNotificationPlugin/blob/master/docs/FirebaseSetup.md
https://github.com/CrossGeeks/FirebasePushNotificationPlugin/blob/master/docs/GettingStarted.md
https://github.com/CrossGeeks/FirebasePushNotificationPlugin/blob/master/docs/FirebaseNotifications.md

Code snippet

App Class

`public partial class App : Application
    {
        public App()
        {
            InitializeComponent();

            MainPage = new FiBPushNotiPluginXF.MainPage();


            CrossFirebasePushNotification.Current.OnTokenRefresh += (s, p) =>
            {
                System.Diagnostics.Debug.WriteLine($"TOKEN : {p.Token}");
            };

            CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) =>
            {

                System.Diagnostics.Debug.WriteLine("Received");

            };

            CrossFirebasePushNotification.Current.OnNotificationOpened += (s, p) =>
            {
                System.Diagnostics.Debug.WriteLine("Opened");
                foreach (var data in p.Data)
                {
                    System.Diagnostics.Debug.WriteLine($"{data.Key} : {data.Value}");
                }

                if (!string.IsNullOrEmpty(p.Identifier))
                {
                    System.Diagnostics.Debug.WriteLine($"ActionId: {p.Identifier}");
                }

            };
        }

`
MainApplication Class

`[Application]
    public class MainApplication : Application
    {
        public MainApplication(IntPtr handle, JniHandleOwnership transer) : base(handle, transer)
        {
        }

        public override void OnCreate()
        {
            base.OnCreate();

            //If debug you should reset the token each time.
#if DEBUG
            FirebasePushNotificationManager.Initialize(this, true);
#else
              FirebasePushNotificationManager.Initialize(this,false);
#endif

            //Handle notification when app is closed here
            CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) =>
            {
                string msg = "Hi";

            };
        }
    }`

MainActivity class

 [Activity(Label = "FiBPushNotiPluginXF", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App());

            FirebasePushNotificationManager.ProcessIntent(Intent);
        }
    }

AndroidManifest file

<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" package="com.xamarin.firebasepushnotificationpluginxfpcl">
	<uses-sdk android:minSdkVersion="15" />
	<uses-permission android:name="android.permission.INTERNET" />
  <permission android:name="com.xamarin.firebasepushnotificationpluginxfpcl.permission.C2D_MESSAGE" android:protectionLevel="signature" />
  <uses-permission android:name="com.xamarin.firebasepushnotificationpluginxfpcl.permission.C2D_MESSAGE" />
  <uses-permission android:name="android.permission.READ_PHONE_STATE" />
	<application android:label="FiBPushNotiPluginXF.Android">
		<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="${applicationId}" />
			</intent-filter>
		</receiver>
	</application>
</manifest>

JSON Payload used for push notification -

{
                "registration_ids": [
                      "eCMPWu62yOU:APA91bEb........."
                ],
                "data": {
                    "msg": "Hello FCM",
                    "title": "Hello FCM",
                    "body": "Hello FCM",
                    "other_key" : true
                },
                "notification": {
                    "title": "notification TITLE",
                    "body": "notification BODY",
                    "click_action":"OPEN_ACTIVITY_1"
                }
                
            }

No event on data only firebase message

Hi

I am trying to send a data message but event is not triggered.
I am using FirebaseNet nuget package as shown in the docs.

When i do :
` FCMClient client = new FCMClient(serverKey);

        var message = new Message()
        {
            Data = data,
        };

        message.RegistrationIds = registrationIds;

        var result = await client.SendMessageAsync(message);
        DownstreamMessageResponse specificResult = (DownstreamMessageResponse)result;`

No events, and a success response from firebase.

When i add the Notification section i do get the event with the data, but i also get the notification ofcourse.

` FCMClient client = new FCMClient(serverKey);

        var message = new Message()
        {
            Data = data,
            Notification = new AndroidNotification()
            {
                Body = body,
                Title = title,
            }
        };

        message.RegistrationIds = registrationIds;

        var result = await client.SendMessageAsync(message);
        DownstreamMessageResponse specificResult = (DownstreamMessageResponse)result;`

I have attached to the handler in Android

` //Handle notification when app is closed here
CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) =>
{

        };`

And the one in App.cs

` private void Current_OnNotificationReceived(object source, FirebasePushNotificationDataEventArgs e)
{

    }`

Neither one of them trigger with the data only.
Any idea's ?

Thanks!

Current_OnNotificationReceived not raised on message send.

Hi

I am trying to get the plugin to work but am not receiving my notifications using Xamarin Forms.

In my App() constructor in the PCL project i put :

CrossFirebasePushNotification.Current.OnTokenRefresh += Current_OnTokenRefresh;
CrossFirebasePushNotification.Current.OnNotificationReceived += Current_OnNotificationReceived; ;
CrossFirebasePushNotification.Current.OnNotificationOpened += Current_OnNotificationOpened;
CrossFirebasePushNotification.Current.OnNotificationError += Current_OnNotificationError;

In my Android app in MainActivity.OnCreate i put :

LoadApplication(new App());
#if DEBUG
            FirebasePushNotificationManager.Initialize(this, true);
#else
              FirebasePushNotificationManager.Initialize(this,false);
#endif
            
            //Handle notification when app is closed here
            CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) =>
            {
                
            };

            FirebasePushNotificationManager.ProcessIntent(Intent);

When i start the app i get the event in my PCL library : Current_OnTokenRefresh which contains a token.

I then take the example from the docs here using firebasenet and send to that token a message.
The response from the request is 'success:1' inside the returned json.
But the event Current_OnNotificationReceived is not received nor is there any notification in the notification tray.

Any help is greatly appreciated.

Is it possible to test Push Notification using Genymotion Emulator for Android?

Also whats the minimum API requirement for Android? While installing the Plugin I had some version incompatibility. I ended up downloading the latest SDK and set the minimum (and target) API to be 24 (7.0). But I'm still having issue deploying the app to emulator, it keeps saying "FirebaseApp initialization unsuccessful".

I checked the logs and noticed that only the following Firebase-related assembly are loaded:

Loaded assembly: /storage/emulated/0/Android/data/com.Test.Droid.QA/files/.__override__/Plugin.FirebasePushNotification.Abstractions.dll [External]
Loaded assembly: /storage/emulated/0/Android/data/com.Test.Droid.QA/files/.__override__/Plugin.FirebasePushNotification.dll [External]
Loaded assembly: /storage/emulated/0/Android/data/com.Test.Droid.QA/files/.__override__/Plugin.Messaging.Abstractions.dll [External]
Loaded assembly: /storage/emulated/0/Android/data/com.Test.Droid.QA/files/.__override__/Plugin.Messaging.dll [External]
Loaded assembly: /storage/emulated/0/Android/data/com.Test.Droid.QA/files/.__override__/Plugin.Settings.Abstractions.dll [External]
Loaded assembly: /storage/emulated/0/Android/data/com.Test.Droid.QA/files/.__override__/Plugin.Settings.dll [External]



Loaded assembly: /storage/emulated/0/Android/data/com.Test.Droid.QA/files/.__override__/Xamarin.Firebase.Common.dll [External]
Loaded assembly: /storage/emulated/0/Android/data/com.Test.Droid.QA/files/.__override__/Xamarin.Firebase.Iid.dll [External]
Loaded assembly: /storage/emulated/0/Android/data/com.Test.Droid.QA/files/.__override__/Xamarin.Firebase.Messaging.dll [External]

Unable to start app after the "Getting Started" part

Hi,

I followed all the steps from "Firebase Setup" and "Getting Started" sections.
But when I try to start the app in an emualtor I'm getting a "An unhandled exception occured."

In the device log I only find th entry: "Firebase initialization unsuccessful"

I'm new to Xamarin and app development so I dont know whereto look exactly

UWP - System.NotImplementedException

When trying to run my UWP project I got this error :

System.NotImplementedException : 'This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation

When I'm doing this :

  CrossFirebasePushNotification.Current.OnTokenRefresh += (s, p) =>
            {
                LoginService.PushNotificationId = p.Token;
            };

I've been installing plugin on all 3rd platforms ofc

Can't send push notification to iOS from POST

hi,

I only have one problem left.
Push notifications are working on android and iOS now when I use the firebase console in the browser.
When I try to you Postman to send a message only my android device gets the notfication.

I'm using this POST body:
{ "notification" : { "body" : "hello!", "title": "afruz", "sound": "default" }, "priority": "high", "condition": "'general' in topics" }

and I'm subscribing to the general topic in the OnStart() function in the App.xaml.cs file.

Another question, where do I get device-IDs?

GoogleServicesJson deserialization error.

I followed Getting Started instructions to install the FirebasePushNotificationPlugin to my Xamarin Forms application for the Android platform.

When I try to build the application, I encounter this error.

/{app folder}/packages/Xamarin.GooglePlayServices.Basement.42.1021.1/build/MonoAndroid70/Xamarin.GooglePlayServices.Basement.targets(61,5): error : Failed to Read or Deserialize GoogleServicesJson file: google-services.json
/{app folder}/Napa.Mobile/packages/Xamarin.GooglePlayServices.Basement.42.1021.1/build/MonoAndroid70/Xamarin.GooglePlayServices.Basement.targets(61,5): error : System.Runtime.Serialization.SerializationException: There was an error deserializing the object of type Xamarin.GooglePlayServices.Tasks.GoogleServices. Encountered an unexpected character 'ï' in JSON.

Any idea what might be causing this exception?

I've used the copy of google-services.json obtained from google for my projects and confirmed it is formed correctly. My only guess is that perhaps something in the data fields might be confusing the deserializer.

Bug Information

Version Number of Plugin: 1.0.4
Device Tested On: android emulator
Simulator Tested On: Nexus 6 API 22
Version of VS: VS/Mac 7.1
Version of Xamarin:
Versions of other things you are using:

Steps to reproduce the Behavior

Followed instructions to install plugin in Android and build.

Expected Behavior

compiles correctly.

Actual Behavior

build fails due to error

Code snippet

Screenshots

Notifications when app is in foreground in iOS 10

Please, add ability to show notifications when app is in foreground in iOS 10.

Example code:

// To receive notifications in foreground on iOS 10 devices.
[Export("userNotificationCenter:willPresentNotification:withCompletionHandler:")]
public async void WillPresentNotification(UNUserNotificationCenter center, UNNotification notification, Action<UNNotificationPresentationOptions> completionHandler)
{
    // Do your magic to handle the notification data
    System.Diagnostics.Debug.WriteLine("WillPresentNotification");

    // Tell system to display the notification anyway or use
    // `None` to say we have handled the display locally.
    completionHandler(UNNotificationPresentationOptions.Alert);
}

Thanks

didReceiveMessage not implemented

I am getting a notification in the Output console but it gives me "FIRMessaging received data-message, but FIRMessagingDelegate's-messaging:didReceiveMessage: not implemented" error. How can I fix it?

Can't deploy app using plugin

Hi,

I'm using the FirebasePushNotification plugin, works fine on the Visual Studio emulator, but when I try to deploy it to my mobile (in debug mode, using Visual Studio), the following error is printed in the output and stop the deploy inmediately

W/System.err(12717): remove failed: ENOENT (No such file or directory) : /data/user/0/com.home.xxxxxx/shared_prefs/Plugin.FirebasePushNotification.xml.bak

I can't figure out what can be the issue, on the emulator works fine, but I can't deploy.
BTW, I already did a clean clone of the repo, I guessed that maybe was a bak file bothering.

Do you have any clue about this issue?

Thanks in advance.

Could not install package on Android

Hi,

I want to install this package on Android 6.0 and I am getting the following error:

Could not install package 'Xamarin.Firebase.Messaging 42.1021.1'. You are trying to install this package into a project that targets 'MonoAndroid,Version=v6.0', but the package does not contain any assembly references or content files that are compatible with that framework. For more information, contact the package author.

Could you please help?
Thanks.

not getting notification when app closed

The app works when app opens and the devices sleep. But when the app closed, it cannot get notification. Could you pls help me resolve the issue?

Bug Information

Version Number of Plugin:
Device Tested On:
Simulator Tested On:
Version of VS:
Version of Xamarin:
Versions of other things you are using:

Steps to reproduce the Behavior

Expected Behavior

Actual Behavior

Code snippet

Screenshotst

Token unregistered - Android

Hi @rdelrosario,

I'm having an issue with my Android App. When I deploy the app to the device, All seems work perfectly, the App refresh a new token if in Debug or Release. but for some reason when I try to send a PNS to that token. I'm getting token Unregistered. Do you know any reason why would that happened.

I reviewed the setup. The one thing that I am doing differently from your sample is starting the app with a Custom handler. I tried already delete Obj/Bin, uninstall the app, install again (it was working later on), but now nothing.

Debug:
FirebasePushNotificationManager.Initialize(this, new CustomPushHandler(), true)
Release:
FirebasePushNotificationManager.Initialize(this, new CustomPushHandler(), false)

Thanks,

Crash on startup

If you are creating an issue for a BUG please fill out this information. If you are asking a question or requesting a feature you can delete the sections below.

Failure to fill out this information will result in this issue being closed. If you post a full stack trace in a bug it will be closed, please post it to http://gist.github.com and then post the link here.

Bug Information

Version Number of Plugin: 1.0.7 and 2.0.1 Alpha
Device Tested On: HTC 10
Simulator Tested On:
Version of VS: 2017 15.3.5
Version of Xamarin: 4.7.9.45
Versions of other things you are using: 7.4.5.1

Steps to reproduce the Behavior

I start the application

Expected Behavior

The app starts and I receive a new token.

Actual Behavior

The app crashes during launch with the following exception:

10-05 21:13:57.590 E/mono-rt (14563): [ERROR] FATAL UNHANDLED EXCEPTION: Java.Lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.postkca.friendsappdate. Make sure to call FirebaseApp.initializeApp(Context) first.
10-05 21:13:57.590 E/mono-rt (14563):   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 
10-05 21:13:57.590 E/mono-rt (14563):   at Java.Interop.JniEnvironment+StaticMethods.CallStaticObjectMethod (Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method) [0x00068] in <e499a5498b1b48379b88fe5ed629079f>:0 
10-05 21:13:57.590 E/mono-rt (14563):   at Android.Runtime.JNIEnv.CallStaticObjectMethod (System.IntPtr jclass, System.IntPtr jmethod) [0x0000e] in <2e14bb2dd93a405e81838369ed72695b>:0 
10-05 21:13:57.590 E/mono-rt (14563):   at Firebase.Iid.FirebaseInstanceId.get_Instance () [0x00032] in <09a4f89addb34f02af055f39e6c540b7>:0 
10-05 21:13:57.590 E/mono-rt (14563):   at Plugin.FirebasePushNotification.FirebasePushNotificationManager+<>c__DisplayClass32_0.<Initialize>b__0 (System.Object state) [0x00177] in C:\Plugins\FirebasePushNotification\src\Plugin.FirebasePushNotification.Android\FirebasePushNotificationManager.cs:134 
10-05 21:13:57.590 E/mono-rt (14563):   at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x00007] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 
10-05 21:13:57.590 E/mono-rt (14563):   at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 
10-05 21:13:57.590 E/mono-rt (14563):   at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 
10-05 21:13:57.590 E/mono-rt (14563):   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00021] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 
10-05 21:13:57.590 E/mono-rt (14563):   at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 
10-05 21:13:57.590 E/mono-rt (14563):   at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in <896ad1d315ca4ba7b117efb8dacaedcf>:0 
10-05 21:13:57.590 E/mono-rt (14563):   --- End of managed Java.Lang.IllegalStateException stack trace ---
10-05 21:13:57.590 E/mono-rt (14563): java.lang.IllegalStateException: Default FirebaseApp is not initialized in this process com.postkca.friendsappdate. Make sure to call FirebaseApp.initializeApp(Context) first.
10-05 21:13:57.590 E/mono-rt (14563): 	at com.google.firebase.FirebaseApp.getInstance(Unknown Source)
10-05 21:13:57.590 E/mono-rt (14563): 	at com.google.firebase.iid.FirebaseInstanceId.getInstance(Unknown Source)
10-05 21:13:57.590 E/mono-rt (14563): 

Code snippet

My Initialization is:


            FirebasePushNotificationManager.Initialize(this, true);
            FirebasePushNotificationManager.ProcessIntent(Intent);

I put both in the SplashActivity. I also tried to put the first statement into my BaseApplication or my MainActivity without success.

Screenshots

Unregister devices

Whenever the user uninstall the app, is the plugin unregistering the device by default? Or would that be something we have to handle manually?

sample compiles with errors

First of all, thank you for sharing your project!

Your plugin looks promising and comes with very good documentation. But, the sample within your source code doesn't compile without twisting. It would be great if you can review the sample projects and provide a sample solution which could be compiled and hence tested.

-- paulus

Bug Information

Version Number of Plugin: 1.0.4
Device Tested On:
Simulator Tested On:
Version of VS: 7.0.1 (build 24) on macOS 10.12.6
Version of Xamarin:
Versions of other things you are using:

Steps to reproduce the Behavior

  1. Download the complete project from Github
  2. Open the sample solution, FirebasePushSample, in VS for Mac
  3. Restore Nuget Packages
  4. Clean the FirebasePushSample
  5. Rebuild the FirebasePushSample

Expected Behavior

Actual Behavior

Code snippet

Screenshotst

/Users/paulus/Projects/FirebasePushNotificationPlugin-master/samples/FirebasePushSample/FirebasePushSample/FirebasePushSample.csproj(5,5): Error: This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is ../../../packages/Xamarin.Forms.2.3.4.247/build/portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20/Xamarin.Forms.targets. (FirebasePushSample)

App crash on startup

I've done everything like in your tutorial. But when I try to launch android app it's crash at startup and returns Unhandled Exception. When I mark FirebasePushNotificationManager.Initialize(this,true); and FirebasePushNotificationManager.ProcessIntent(Intent); as a comment app works as normal without any issue.

can not receive notifications in iOS only in Android in version 2.0.1-alpha

#45

In firebase, cloud messaging for iOS says:
"Firebase Cloud Messaging can use either an APNs authentication key or APNs certificate to connect with APNs"
So I uploaded an "APNs Authentication Key" (*.p8)
Firebase automatically disables the option to upload "APNs Certificates"
So "Development APNs certificate" and "Production APNs certificate" are empty, I did not uploaded any certificates there.

When I send notification to iOS devices from Firebase console, the status changes to 'completed'

I'm using a physical device, iPhone 6 plus 10.3.2

When I run the app for the first time it asks me if I want to receive notifications, which is good

My provisioning profile has the push notifications enabled

In my info-plist under capabilities I have remote notifications enabled

And all the code that you tutorial provides for iOS as well

But I don't receive notifications, any ideas?

Android application enters break mode

Hello,

I want to use this plugin for Android and I follow the tutorial but the application keeps entering break mode. What do I wrong?

            [Application]
    public class MainApplication : Application
    {
        public MainApplication(IntPtr handle, JniHandleOwnership transer) : base(handle, transer)
        {
        }

        public override void OnCreate()
        {
            base.OnCreate();

            //If debug you should reset the token each time.
            try
            {
#if DEBUG
                FirebasePushNotificationManager.Initialize(this, true);
#else
              FirebasePushNotificationManager.Initialize(this,false);
#endif
            }
            catch(Exception ex)
            {

            }

            //Handle notification when app is closed here
            CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) =>
            {


            };
        }
    }

CrossFirebasePushNotification.Current.OnNotificationOpened Event is not firing

If you are creating an issue for a BUG please fill out this information. If you are asking a question or requesting a feature you can delete the sections below.

Failure to fill out this information will result in this issue being closed. If you post a full stack trace in a bug it will be closed, please post it to http://gist.github.com and then post the link here.

Bug Information

Version Number of Plugin: 1.0.7
Device Tested On: Huawei Mate 8
Simulator Tested On: NA
Version of VS: 2017
Version of Xamarin: 2.4.0.282
Versions of other things you are using: Android 7

Steps to reproduce the Behavior

Open received notification from Notification Bar

Expected Behavior

Code inside CrossFirebasePushNotification.Current.OnNotificationOpened Event executed

Actual Behavior

Application goes to main activity and event is not fired

Code snippet

MainActivity.cs
[Activity(Label = "@string/app_name", Theme = "@style/MyTheme", ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
TabLayoutResource = Resource.Layout.Tabbar;
ToolbarResource = Resource.Layout.Toolbar;

        base.OnCreate(bundle);
  

        global::Xamarin.Forms.Forms.Init(this, bundle);

        LoadApplication(new App());

        FirebasePushNotificationManager.ProcessIntent(Intent);

        CrossFirebasePushNotification.Current.Subscribe("general");
    }
}

MainApplication.cs
public override void OnCreate()
{
base.OnCreate();
RegisterActivityLifecycleCallbacks(this);

        //If debug you should reset the token each time.
       #if DEBUG
        FirebasePushNotificationManager.Initialize(this, true);
       #else
        FirebasePushNotificationManager.Initialize(this,false);
       #endif

        //Handle notification when app is closed here
        CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) =>
        {
            System.Diagnostics.Debug.WriteLine("Received");               
        };

        CrossFirebasePushNotification.Current.OnNotificationOpened += (ss, pp) =>
        {
            //System.Diagnostics.Debug.WriteLine(p.Identifier);

            System.Diagnostics.Debug.WriteLine("Opened");
            foreach (var data in pp.Data)
            {
                System.Diagnostics.Debug.WriteLine($"{data.Key} : {data.Value}");
            }

            if (!string.IsNullOrEmpty(pp.Identifier))
            {
                //Device.BeginInvokeOnMainThread(() =>
                //{
                //    App.OpenNotification(pp.Identifier);
                //    //textLabel.Text = p.Identifier;
                //});
            }
            else if (pp.Data.ContainsKey("aps.alert.title"))
            {
                //Device.BeginInvokeOnMainThread(() =>
                //{
                //    //textLabel.Text = p.Data["aps.alert.title"];
                //});

            }
        };
    }

Screenshots

updating to the latest version of xamarin forms, seems to have messed up something

If you are creating an issue for a BUG please fill out this information. If you are asking a question or requesting a feature you can delete the sections below.

Failure to fill out this information will result in this issue being closed. If you post a full stack trace in a bug it will be closed, please post it to http://gist.github.com and then post the link here.

Bug Information

Version Number of Plugin:
Device Tested On:
Simulator Tested On:
Version of VS:
Version of Xamarin:
Versions of other things you are using:

Steps to reproduce the Behavior

update to the latest version of xamarin forms

Expected Behavior

successfully re/build solution

Actual Behavior

Can't resolve the reference 'System.Void Firebase.Analytics.App::Configure()', referenced from the method 'System.Void Plugin.FirebasePushNotification.FirebasePushNotificationManager/d__31::MoveNext()' in 'Firebase.Analytics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. Insider.iOS

Code snippet

Screenshots

image

Not receiving the Push when Android APP is Closed

Bug Information

Version Number of Plugin:
Device Tested On:
Simulator Tested On:
Version of VS:
Version of Xamarin:
Versions of other things you are using:

Steps to reproduce the Behavior

The Android version doesn't handler push when the APP is closed, I used the instructions of put in my MainApplication class the event handler as followed:

//Handle notification when app is closed here
CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) =>
{
var intent = new Intent(this, typeof(MainApplication));
intent.AddFlags(ActivityFlags.SingleTop); // origin --> .ClearTask
var defaultSoundUri = RingtoneManager.GetDefaultUri(RingtoneType.Notification);
var pendingIntent = PendingIntent.GetActivity(this, 0 /* Request code */, intent, PendingIntentFlags.OneShot);

            var builder = new NotificationCompat.Builder(this)
                .SetSmallIcon(Resource.Drawable.Icon)
                .SetContentTitle("test")
                .SetContentText("Teste receiving backgroudnotification")
                .SetAutoCancel(true)
                .SetContentIntent(pendingIntent)
                .SetSound(defaultSoundUri);

            var notificationManager = NotificationManager.FromContext(this);
            notificationManager.Notify(1, builder.Build());
            System.Diagnostics.Debug.WriteLine("NOTIFICATION RECEIVED", p.Data);
        };

But the only thing I'm getting is that the Push is duplicated when the app is running. but nothing happened when the is app is closed.

iOS is working smoothly.

Thanks in advance.

Screenshotst

Foundation.You_Should_Not_Call_base_In_This_Method thrown after adding plugin via "Getting Started" instructions

Is the call to base.FailedToRegisterForRemoteNotifications(application, error) really necessary for iOS? After following the "getting started" instructions, my application crashed from an uncaught exception stating that the base shouldn't be called here. If it's not actually necessary, it might be good to remove the line from the documentation.

Bug Information

Version Number of Plugin: 1.0.4
Device Tested On:
Simulator Tested On: iPhone 6 iOS 10.3
Version of VS: 2017 (15.3.0)
Version of Xamarin: 4.6.0.295
Versions of other things you are using:

  • Xamarin.Forms 2.3.4.224

Steps to reproduce the Behavior

  1. Follow the instructions at https://github.com/CrossGeeks/FirebasePushNotificationPlugin/blob/69c9570a00fbe91259071fb296f9f9e327dc5328/docs/GettingStarted.md to add FirebasePushNotificationPlugin to an existing Xamarin.Forms application.
  2. Subscribe to a topic in the App.OnStart() method in the common Xamarin.Forms application project.

Expected Behavior

iOS notification asking user to confirm if they want to receive push notifications appears. If the user confirms, then the app should be subscribed to the topic from step 2.

Actual Behavior

iOS notification asking user to confirm if they want to receive push notifications appears. If the user confirms, then the app crashes in the FailedToRegisterForRemoteNotifications(UIApplication, NSError) method of the app delegate class in the Xamarin.Forms iOS project due to base.FailedToRegisterForRemoteNotifications(application, error) throwing Foundation.You_Should_Not_Call_base_In_This_Method.

Code snippet

In application project:

namespace MyApplication
{
    public partial class App : Application
    {
        protected override void OnStart()
        {
            // Handle when your app starts
            MobileCenter.Start(
                @"android={MCAndroidGuid};ios={MCiOSGuid};uwp={MCUwpGuid};",
                typeof(Analytics),
                typeof(Crashes));

            // ReSharper disable once StringLiteralTypo
            DependencyService.Get<ISystemLogger>().AppCode = "MyApplication";

            CrossFirebasePushNotification.Current.Subscribe("news");
        }
    }
}

In iOS platform project:

namespace MyApplication.iOS
{
    [Register("AppDelegate")]
    public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
    {
        public override void FailedToRegisterForRemoteNotifications(UIApplication application, NSError error)
        {
            base.FailedToRegisterForRemoteNotifications(application, error); // this throws the exception
            FirebasePushNotificationManager.RemoteNotificationRegistrationFailed(error);
        }
    }
}

Screenshots

See exception stack at https://gist.github.com/coldacid/e284b677336d89e74e75a6189cc7b1bd

Cannot display Heads-up notification

If you are creating an issue for a BUG please fill out this information. If you are asking a question or requesting a feature you can delete the sections below.

Failure to fill out this information will result in this issue being closed. If you post a full stack trace in a bug it will be closed, please post it to http://gist.github.com and then post the link here.

Bug Information

Some devices can display Heads-up notification and badge (Xiaomi android 6.0) but LG g3 (android 6.0) cannot.
Could you help me, pls? Could I permission for it???
Version Number of Plugin:
Device Tested On: LG g3 6.0
Simulator Tested On:
Version of VS:
Version of Xamarin:
Versions of other things you are using:

Steps to reproduce the Behavior

Expected Behavior

Actual Behavior

Code snippet

Screenshots

Notification not receive

Hello, i have problem.

I don't receive notification, i receive token so on firebase i go to send a notification to token but i'm not fire event OnNotificationReceived or OnNotificationError, so i try to send on all users in android but it's the same result.

Any idea for resolve that ?

Bug Information

Version Number of Plugin:
Device Tested On: Wiko Fever
Simulator Tested On: Wiko Fever
Version of VS: latest stable
Version of Xamarin: latest stable

Question about "splashscreen" activity

Hello, I have one question. Im compiling against API 24 in android and my minimum API version is 16. I followed your getting started guide, but my app is still crashing. It says that default firebase app is not initialized. I'm using simple trick with other activity as Splash screen for application (and it's set as main launcher). Main activity, where xamarin PCL project is initialized is launched from there and I added FirebasePushNotificationManager.ProcessIntent(Intent); just after LoadApplication in that activity. Also I have created MainApplication class and filled it with code. Even so it still crashes. Is this caused because of my splash activity, or am I doing something wrong?

Edit: Stupid me... I should read closed issues first. It's now opening properly, but says SERVICE_NOT_AVAILABLE

Set custom icon for notifications

Hi,
how can i set a custom icon for notifications in stead of the application icon.

I create a separate black/white Icon to use as the notification indicator icon.
->this looks much better than my colored app icon (rendered to a flat round white ball in notifications)

Refresh token each time start app.

Hi, is it normal that each time i start the app i register a new token?

I set: FirebasePushNotificationManager.Initialize(this,false);

App crashes on startup with the sample code w/ Xamarin forms

Java.Lang.IllegalStateException: Default FirebaseApp is not initialized in this process
Make sure to call FirebaseApp.initializeApp(Context) first.

This is the error that is thrown. I've looked into the previously solved issue on here that had the same problem, but the solution listed there doesn't work at all on my side (clean/rebuild as well as adding the target entry to csproj).

Here is a gist of the exception stack trace.

Bug Information

Version Number of Plugin: v.1.0.4
Device Tested On: Galaxy S7
Simulator Tested On: n/a
Version of VS: 2017 latest
Version of Xamarin: 4.5.0.486
Versions of other things you are using: X.Forms version 2.3.4.267

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.