OneSignal / OneSignal-Xamarin-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your Xamarin app with OneSignal. https://onesignal.com
Other
105 stars 50 forks source link

One signal stop sending push notification after running app on debug a 2nd time. #161

Closed Kelve17 closed 5 years ago

Kelve17 commented 5 years ago

Description:

Hi. I have a xamarin.forms app where i need to send push notifications. however, everytime i debug the app a second time, the notifications stop being sent. I can only debug 1 time with the firebase project credentials in order to receive the notifications. If i debug a 2nd time, i think one signal recognizes that the app has been unninstalled and can't receive notification.

Environment

Xamarin.Forms 4.1.0.581479 Nuget

Steps to Reproduce Issue:

  1. Add version 4.1.0.581479 of the Xamarin SDK to your project
  2. Initialize the SDK with your App ID
  3. Attempt to receive a push notification
  4. Run app in debug mode
  5. Close debug mode
  6. Run app again in debug mode
  7. Attempt to send a push notification
  8. One signal recognizes that the app has been unninstalled and does not send notification.

Anything else:

rgomezp commented 5 years ago

@Kelve17 , Uninstalling the app should unsubscribe the player from receiving OneSignal notifications. This is the expected behavior. Am I missing something?

Edit: you may be using two Firebase project ids in your app (e.g: for another sdk) which may cause problems such as what you're seeing

Kelve17 commented 5 years ago

@Kelve17 , Uninstalling the app should unsubscribe the player from receiving OneSignal notifications. This is the expected behavior. Am I missing something?

Edit: you may be using two Firebase project ids in your app (e.g: for another sdk) which may cause problems such as what you're seeing

Is it possible to be using 2 firebase projects ? Isn't it needed only 1 server api key from the firebase project ?

The problem is that as soon as i debug my app a 2nd time, one signal stops sending notifications.

After making many tests, i found that when i remove bin/obj folders, clean the solution and unninstall app manually from the device(emulator or real) the notifications start working again.

rgomezp commented 5 years ago

This is strange. When I mean 2 firebase projects I mean if you are using another SDK that requires you set up its own firebase project id.

Kelve17 commented 5 years ago

This is strange. When I mean 2 firebase projects I mean if you are using another SDK that requires you set up its own firebase project id.

No. Im not using any other sdk. I have just created a project on firebase and copied its server key to my one signal project. I am testing on my real device which is Hwawei. I have seen that hwawei devices have some problems with one signal notifications. Maybe when i debug my app, i need to apply these settings everytime ?

rgomezp commented 5 years ago

Are you able to reproduce on any other type of device?

Kelve17 commented 5 years ago

When i run on emulator it works fine but on my hwawei device i need to make these steps. Maybe this is a problem only with hwawei systems.

rgomezp commented 5 years ago

Huawei devices run a modified version of Android OS called EMUI. By default, EMUI versions earlier than 4.1 automatically kill background apps every time the device's screen is off, unless they are marked is a Protected App in the device's Battery Management page in Advanced Settings.

This causes notifications to not be received by apps that are not on the Protected Apps list. Apart from interfering with notifications, it also causes frequently used apps to start slower, and can cause you to lose your place in games and other apps when the device is locked.

Kelve17 commented 5 years ago

Alright. Thank you @rgomezp

rgomezp commented 5 years ago

My pleasure!