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

Push Notifications are not getting triggered on Android 12 and latest. #761

Open
sirishaveeralapalli opened this issue Apr 13, 2023 · 6 comments

Comments

@sirishaveeralapalli
Copy link

sirishaveeralapalli commented Apr 13, 2023

Xamarin.Android Version (eg: 6.0): 5.0.0.2578

Operating System & Version (eg: Mac OSX 10.11): Ventura 13.1

Xamarin.Firebase.Messaging

Version : 123.1.1.1

Describe your Issue

When trying to trigger a "test send" notification from Microsoft Azure notification hub, the result says that the notification has been sent successfully, but the Android devices with OS 12 and latest don't seem to get any notifications. However, the Android devices with OS version less than 11 are getting the notifications.

Relevant information

Add relevant project settings from *.csproj file:

Packages used:

<PackageReference Include="Xamarin.Forms" Version="5.0.0.2578" />
    <PackageReference Include="Xamarin.Essentials" Version="1.7.5" />
	<PackageReference Include="Xamarin.AndroidX.Lifecycle.LiveData" Version="2.6.1" />
    <PackageReference Include="Xamarin.AndroidX.Browser" Version="1.5.0" />
    <PackageReference Include="Xamarin.Google.Android.Material" Version="1.8.0" />
    <PackageReference Include="Xamarin.AndroidX.Legacy.Support.V4" Version="1.0.0.16" /> 
    <PackageReference Include="Newtonsoft.Json">
      <Version>13.0.3</Version>
    </PackageReference>
    <PackageReference Include="AndHUD">
      <Version>1.4.2</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Azure.NotificationHubs.Android">
      <Version>1.1.4.1</Version>
    </PackageReference>
    <PackageReference Include="OxyPlot.Core">
      <Version>2.0.0</Version>
    </PackageReference>
    <PackageReference Include="OxyPlot.Xamarin.Android">
      <Version>1.0.0</Version>
    </PackageReference>
    <PackageReference Include="Plugin.Permissions">
      <Version>6.0.1</Version>
    </PackageReference>
    <PackageReference Include="Microsoft.AppCenter.Crashes">
      <Version>5.0.1</Version>
    </PackageReference>
    <PackageReference Include="Microsoft.AppCenter.Analytics">
      <Version>5.0.1</Version>
    </PackageReference>
    <PackageReference Include="Microsoft.Identity.Client">
      <Version>4.52.0</Version>
    </PackageReference>
    <PackageReference Include="Plugin.CurrentActivity">
      <Version>2.1.0.4</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Google.Dagger">
      <Version>2.44.2.1</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Firebase.Messaging">
      <Version>123.1.1.1</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.Android.Support.v4">
      <Version>28.0.0.3</Version>
    </PackageReference>
    <PackageReference Include="Xamarin.AndroidX.Core">
      <Version>1.9.0.2</Version>
    </PackageReference>
    <PackageReference Include="OxyPlot.Xamarin.Forms">
      <Version>1.0.0</Version>
    </PackageReference>

Build settings (tools)

<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
    <DebugSymbols>true</DebugSymbols>
    <DebugType>portable</DebugType>
    <Optimize>true</Optimize>
    <OutputPath>bin\Release</OutputPath>
    <ErrorReport>prompt</ErrorReport>
    <WarningLevel>4</WarningLevel>
    <AndroidManagedSymbols>true</AndroidManagedSymbols>
    <AndroidUseSharedRuntime>false</AndroidUseSharedRuntime>
    <AndroidPackageFormat>apk</AndroidPackageFormat>
<AndroidLinkMode>None</AndroidLinkMode>
  </PropertyGroup>

NOTE: Please DO NOT submit screenshot images. Images are not searchable!

Minimal Repro Code Sample

If you want to speed up investigation and bug fixing: please provide minimal repro sample for tests.

Steps to Reproduce (with link to sample solution if possible):

-> Login to the application
-> In the relevant notification hub, click on test send
-> Provide the tag expression
-> Click on "Test Send"
-> Observe that the result says " The Push Notification has been sent successfully ".
-> But your device doesn't receive any.

Include any relevant Exception Stack traces, build logs, adb logs:

@jkommeren
Copy link

jkommeren commented Apr 13, 2023

I have similar problems with version 123.0.0.7 with Release profile.

The Debug build profile DOES work for me for some reason. Please fix this.

@moljac
Copy link
Member

moljac commented Apr 18, 2023

@sirishaveeralapalli
Copy link
Author

We have already enable this.
Screenshot 2023-04-19 at 10 40 19 AM

@aritchie
Copy link
Contributor

You need to realize that these are only bindings against the android libraries here. Unless one of the bindings is wrong, there aren't going to be any sort of bugs that can be fixed here.

Even if you've added android.permissions.POST_NOTIFICATIONS to your manifest, you still have to request the permission. That particular permission is only required for ANDROID 13 (API 33+). For what it's worth, this binding is working just fine and I use it in my library Shiny without issue.

@jkommeren
Copy link

Hmm. Well in my case at least the application asks for permission to show notifications and the user is prompted at first startup.

Also the portal test notifications do show up when the app is running in the background. In my case at least.

Could this be a signing issue? 🤔

@jkommeren
Copy link

jkommeren commented May 21, 2023

Update: turns out Trimming in release mode in Maui .net 7 was my issue.
After disabling it in csproj it works again.

< PublishTrimmed>False< /PublishTrimmed>

(Remove spaces)

Still unsure which component broke due to the Trimming. Will report back if I find more.

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

4 participants