Forum Xamarin.Android
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Push Notification not comming when app is killed

kosteashkosteash Member ✭✭

Hello everyone,
I use AzurePushNotificationPlugin for Pushs.
It doesn't work on the android, although it works on iOS.
I already rummaged throug everything that is possible, but did not find anyting.

Best Answer

  • kosteashkosteash Member ✭✭
    Accepted Answer

    Hi,
    I had to create Application classe and Push there initialize !
    tnx :)

Answers

  • kosteashkosteash Member ✭✭
    edited April 30

    Here is my manifest:
    <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="6" android:versionName="1.0.7" package="co.my.package" android:installLocation="preferExternal"> <uses-sdk android:minSdkVersion="26" android:targetSdkVersion="28" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.RECORD_AUDIO" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="${applicationId}.C2D_MESSAGE" /> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <permission android:name="${applicationId}.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <uses-feature android:name="android.hardware.camera" android:required="true" /> <application android:label="BIGO"> <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>

  • kosteashkosteash Member ✭✭

    In foreground and background all working.
    I have failed the standard solution with

    [Service] [IntentFilter(new[] { "com.google.firebase.MESSAGING_EVENT" })] public class FirebaseNotificationService : FirebaseMessagingService
    and
    [Service] [IntentFilter(new[] { "com.google.firebase.INSTANCE_ID_EVENT" })] public class FirebaseRegistrationService : FirebaseInstanceIdService
    also did not work

  • kosteashkosteash Member ✭✭

    Here is my device log info, when i send push from azura. (co.my.package)

    Time Device Name Type PID Tag Message 04-30 19:06:29.531 Google Pixel 2 XL Info 8886 Appboy v3.5.0 .com.appboy.AppboyFirebaseMessagingService Remote message did not originate from Braze. Not consuming remote message: [email protected] 04-30 19:06:43.252 Google Pixel 2 XL Info 8886 Appboy v3.5.0 .com.appboy.AppboyFirebaseMessagingService Remote message did not originate from Braze. Not consuming remote message: [email protected] 04-30 19:06:41.843 Google Pixel 2 XL Debug 26566 ClClient Not sending keepalive. Current connection state=STOPPED 04-30 19:06:39.184 Google Pixel 2 XL Info 8886 Appboy v3.5.0 .com.appboy.AppboyFirebaseMessagingService Remote message did not originate from Braze. Not consuming remote message: [email protected] 04-30 19:06:37.318 Google Pixel 2 XL Info 8886 Appboy v3.5.0 .com.appboy.AppboyFirebaseMessagingService Remote message did not originate from Braze. Not consuming remote message: [email protected] 04-30 19:06:36.279 Google Pixel 2 XL Info 8886 Appboy v3.5.0 .com.appboy.AppboyFirebaseMessagingService Remote message did not originate from Braze. Not consuming remote message: [email protected] 04-30 19:06:35.702 Google Pixel 2 XL Debug 1301 ConnectivityService Blocked status changed to true for 10228(1813) on netId 108 04-30 19:06:35.701 Google Pixel 2 XL Debug 1301 ConnectivityService Blocked status changed to true for 10228(1812) on netId 108 04-30 19:06:35.701 Google Pixel 2 XL Debug 1301 ConnectivityService Blocked status changed to true for 10228(1810) on netId 108 04-30 19:06:35.700 Google Pixel 2 XL Debug 1301 ConnectivityService Blocked status changed to true for 10228(1809) on netId 108 04-30 19:06:35.698 Google Pixel 2 XL Info 794 netd firewallSetUidRule(2, 10228, 2) <7.70ms> 04-30 19:06:35.639 Google Pixel 2 XL Debug 1301 ConnectivityService Blocked status changed to false for 10228(1813) on netId 108 04-30 19:06:35.639 Google Pixel 2 XL Debug 1301 ConnectivityService Blocked status changed to false for 10228(1812) on netId 108 04-30 19:06:35.638 Google Pixel 2 XL Debug 1301 ConnectivityService Blocked status changed to false for 10228(1810) on netId 108 04-30 19:06:35.637 Google Pixel 2 XL Debug 1301 ConnectivityService Blocked status changed to false for 10228(1809) on netId 108 04-30 19:06:35.632 Google Pixel 2 XL Info 794 netd firewallSetUidRule(2, 10228, 1) <10.04ms> 04-30 19:06:35.597 Google Pixel 2 XL Warning 1301 ActivityManager Stopping service due to app idle: u0a176 -2m53s847ms com.whatsapp/.messaging.MessageService 04-30 19:06:35.526 Google Pixel 2 XL Warning 24004 GmsLocationProvider Error removing location updates: 16 04-30 19:06:35.198 Google Pixel 2 XL Info 918 CHRE @ 32477.213: [ImuCal] [NanoSensorCal:GYRO_RPS] Temp Intercept: 0.004955, -0.007083, -0.008478 04-30 19:06:35.198 Google Pixel 2 XL Info 918 CHRE @ 32477.213: [ImuCal] [NanoSensorCal:GYRO_RPS] Temp Sensitivity: 0.000016, 0.000292, 0.000063 04-30 19:06:35.197 Google Pixel 2 XL Info 918 CHRE @ 32477.213: [ImuCal] [NanoSensorCal:GYRO_RPS] Offset | Temperature [C]: 0.005448, 0.001560, -0.006602 | 29.72 04-30 19:06:35.143 Google Pixel 2 XL Info 918 CHRE @ 32477.159: [ImuCal] [NanoSensorCal:GYRO_RPS] Temp Intercept: 0.004955, -0.007083, -0.008478 04-30 19:06:35.143 Google Pixel 2 XL Info 918 CHRE @ 32477.159: [ImuCal] [NanoSensorCal:GYRO_RPS] Temp Sensitivity: 0.000016, 0.000292, 0.000063 04-30 19:06:35.142 Google Pixel 2 XL Info 918 CHRE @ 32477.159: [ImuCal] [NanoSensorCal:GYRO_RPS] Offset | Temperature [C]: 0.005448, 0.001560, -0.006602 | 29.72 04-30 19:06:33.012 Google Pixel 2 XL Info 8886 Appboy v3.5.0 .com.appboy.AppboyFirebaseMessagingService Remote message did not originate from Braze. Not consuming remote message: [email protected] 04-30 19:06:32.388 Google Pixel 2 XL Info 8886 Appboy v3.5.0 .com.appboy.AppboyFirebaseMessagingService Remote message did not originate from Braze. Not consuming remote message: [email protected] 04-30 19:06:31.838 Google Pixel 2 XL Debug 26566 ClClient Not sending keepalive. Current connection state=STOPPED 04-30 19:06:29.947 Google Pixel 2 XL Info 8886 Appboy v3.5.0 .com.appboy.AppboyFirebaseMessagingService Remote message did not originate from Braze. Not consuming remote message: [email protected] 04-30 19:06:29.563 Google Pixel 2 XL Info 8886 Appboy v3.5.0 .com.appboy.AppboyFirebaseMessagingService Remote message did not originate from Braze. Not consuming remote message: [email protected] 04-30 19:06:21.833 Google Pixel 2 XL Debug 26566 ClClient Not sending keepalive. Current connection state=STOPPED 04-30 19:06:13.536 Google Pixel 2 XL Warning 27044 co.my.package JNI RegisterNativeMethods: attempt to register 0 native methods for xamarin.essentials.fileProvider 04-30 19:06:13.527 Google Pixel 2 XL Info 27044 FirebaseInitProvider FirebaseApp initialization successful 04-30 19:06:13.527 Google Pixel 2 XL Debug 27044 FirebaseApp com.google.android.gms.measurement.AppMeasurement is not linked. Skipping initialization. 04-30 19:06:13.527 Google Pixel 2 XL Debug 27044 FirebaseApp com.google.firebase.crash.FirebaseCrash is not linked. Skipping initialization. 04-30 19:06:13.526 Google Pixel 2 XL Debug 27044 FirebaseApp com.google.firebase.auth.FirebaseAuth is not linked. Skipping initialization. 04-30 19:06:13.468 Google Pixel 2 XL Warning 27044 co.my.package Attempt to remove non-JNI local reference, dumping thread 04-30 19:06:13.091 Google Pixel 2 XL Warning 27044 monodroid-gc GREF GC Threshold: 46080 04-30 19:06:12.785 Google Pixel 2 XL Debug 918 ASH @ 32454.793: Sending to ASH storage: 0 670 0 04-30 19:06:12.776 Google Pixel 2 XL Debug 918 ASH @ 32454.793: AP has been up: last 32154553727, now 32454793238 usec 04-30 19:06:12.447 Google Pixel 2 XL Warning 27044 monodroid Using runtime path: /data/app/co.my.package-wdzfPgZFnOWtI-5tzbcCiw==/lib/arm64 04-30 19:06:12.447 Google Pixel 2 XL Warning 27044 co.my.package Attempt to remove non-JNI local reference, dumping thread 04-30 19:06:11.974 Google Pixel 2 XL Error 27044 co.my.package Unknown bits set in runtime_flags: 0x8000 04-30 19:06:11.938 Google Pixel 2 XL Info 27044 co.my.package Late-enabling -Xcheck:jni 04-30 19:06:11.922 Google Pixel 2 XL Info 1301 ActivityManager Start proc 27044:co.my.package/u0a375 for broadcast {co.my.package/com.google.firebase.iid.FirebaseInstanceIdReceiver} 04-30 19:06:11.920 Google Pixel 2 XL Debug 814 Zygote Forked child process 27044 04-30 19:06:11.814 Google Pixel 2 XL Debug 26566 ClClient Not sending keepalive. Current connection state=STOPPED

  • JuniorJiangJuniorJiang Member, Xamarin Team Xamurai

    Unlike other platforms, if your Android app is closed, it will not receive Push Notifications. This is because Android receives push notifications via a service that the app launches. If the app is closed, then the service is not running and hence the app will not receive any push notifications.

    However , there are some ways around this . You can have a look at follow discussions :

    Notifications to work on Android if the app is closed, stopped or not running?

    How to get android notifications when app was closed?

    And , here is a previous workaround : Push Notifications Lifecycle

  • kosteashkosteash Member ✭✭
    Accepted Answer

    Hi,
    I had to create Application classe and Push there initialize !
    tnx :)

Sign In or Register to comment.