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
104 stars 50 forks source link

Xamarin IdsAvailable callback fail #246

Closed fsantanac closed 2 years ago

fsantanac commented 2 years ago

Description:

Hi. We have a problem with the IdsAvailable callback. It is supposed that if a device is in User Opted Out state, the pushtoken value of the callback should come to null. Well in android it comes correctly to null but in ios it returns a valid token. This makes that we do not know the state of the ios devices.

Is it a bug or is there another way that we have not found in the documentation to know in Xamarin the state of the devices?

Environment

<PackageReference Include="Com.OneSignal" Version="3.10.6" />

<PackageReference Include="Xamarin.Forms" Version="5.0.0.2083" />
<PackageReference Include="Com.OneSignal" Version="3.10.6" />

Steps to Reproduce Issue:

  1. Call IdsAvailable
  2. In callback pushToken return valid push

OneSignal.Current.IdsAvailable(IdsAvailable);

    private void IdsAvailable(string userID, string pushToken)
    {

// pushToken in android return null ok // pushToken in iOS return pushToken valid with User Opted Out state try { if (pushToken != null) { Preferences.Set("PushAllow", true); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }

tanaynigam commented 2 years ago

@fsantanac Thanks for reporting the issue. We have a release OneSignalSDK.Xamarin-4.0.0 in which this issue no longer seems to exist.

we have moved the push notification subscription status' ids to a new api. You check out our documentation on the changes regarding the status ids in our OneSignal Xamarin 4.0.0 API reference documentation

Please note that we have changed the package name and namespace for the SDK from Com.OneSignal to OneSignalSDK.Xamarin and would require you to remove the previous package name and add the new package name to import the SDK in your code.

Additionally, when searching for the package on nuget.org, you will be required to search for OneSignalSDK.Xamarin to import the package