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

Huawei (Android 6.0.1) can't trigger notifications when the app is killed (except if added to the list of "protected apps") #92

Open
Cachwir opened this issue Apr 1, 2021 · 0 comments

Comments

@Cachwir
Copy link

Cachwir commented Apr 1, 2021

Bug Report

On an Android 6.0.1 Huawei (Emui 4.0), it is required to add my app to the list of "protected apps" if I want to receive notifications when the app is killed. This was not necessary when using phonegap-plugin-push with cordova-android v6.3.0.

Expected Behaviour

You don't need to do anything as a user, to properly receive notifications when the app is killed.

Actual Behaviour

You need to do some manual work on the phone in order to properly receive notifications when the app is killed.

Reproduce Scenario (including but not limited to)

Steps to Reproduce

  1. On a Huawei with EMUI 4.0, create a cordova app using cordova 10 and cordova-android 9. For compatibility, refer to this post.
  2. Init cordova-plugin-push (v2) like in the documentation. Install, open and kill the app.
  3. Send a notification from the server and confirm no notification appears.
  4. Go to setting->advanced settings->battery management->protected apps->check your app
  5. Reproduce step 3 and confirm a notification appears this time

Platform and Version (eg. Android 5.0 or iOS 9.2.1)

Emui 4.0 (Android 6.0.1)

(Android) Device Vendor (e.g. Samsung, HTC, Sony...)

Huawei

cordova info Printout

Available Android targets:==============] 100% Fetch remote repository...

id: 1 or "android-23"
Name: Android API 23
Type: Platform
API level: 23
Revision: 3

id: 2 or "android-26"
Name: Android API 26
Type: Platform
API level: 26
Revision: 2

id: 3 or "android-28"
Name: Android API 28
Type: Platform
API level: 28
Revision: 6

id: 4 or "android-29"
Name: Android API 29
Type: Platform
API level: 29
Revision: 5

Project Setting Files:

config.xml:
MyApp MyApp MyApp Background location tracking is required for our app so we can tell you if there is a visit or an event next to your location (only for the users who agreed to subscribe) Background location tracking is required for our app so we can tell you if there is a visit or an event next to your location (only for the users who agreed to subscribe) Background location tracking is required for our app so we can tell you if there is a visit or an event next to your location (only for the users who agreed to subscribe) Device motion updates help determine when the device is stationary so the app can save power by turning off location-updates We use Appsflyer to handle deeplinks easier and not for tracking the user's data CFBundleURLSchemes mydomain applinks:mydomain.onelink.me
package.json:

--- Start of Cordova JSON Snippet ---
{
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-zip": {},
"cordova-plugin-autostart": {},
"cordova-plugin-geolocation": {
"GPS_REQUIRED": "true"
},
"cordova-plugin-app-launcher": {},
"cordova-plugin-compat": {},
"cordova-plugin-device": {},
"cordova-plugin-webview-checker": {},
"es6-promise-plugin": {},
"cordova-plugin-file": {},
"cordova-plugin-badge": {},
"cordova-plugin-vibration": {},
"cordova-plugin-app-version": {},
"cordova-plugin-buildinfo": {},
"cordova-plugin-network-information": {},
"cordova-android-firebase-gradle-release": {
"FIREBASE-CORE": "17.0.0",
"FIREBASE-ADS": "18.0.0",
"FIREBASE-ANALYTICS": "17.0.0",
"FIREBASE-APPINDEXING": "19.0.0",
"FIREBASE-AUTH": "18.0.0",
"FIREBASE-FIRESTORE": "20.0.0",
"FIREBASE-FUNCTIONS": "18.0.0",
"FIREBASE-MESSAGING": "19.0.0",
"FIREBASE-STORAGE": "18.0.0",
"FIREBASE-CRASH": "16.2.1",
"CRASHLYTICS": "2.10.1",
"FIREBASE-DYNAMIC-LINKS": "18.0.0",
"FIREBASE-INVITES": "17.0.0",
"FIREBASE-INAPPMESSAGING": "18.0.1",
"FIREBASE-INAPPMESSAGING-DISPLAY": "18.0.1",
"FIREBASE-ML-VISION": "21.0.0",
"FIREBASE-ML-VISION-IMAGE-LABEL-MODEL": "18.0.0",
"FIREBASE-ML-VISION-FACE-MODEL": "18.0.0",
"FIREBASE-ML-VISION-OBJECT-DETECTION-MODEL": "17.0.0",
"FIREBASE-ML-NATURAL-LANGUAGE": "20.0.0",
"FIREBASE-ML-NATURAL-LANGUAGE-LANGUAGE-ID-MODEL": "20.0.0",
"FIREBASE-ML-NATURAL-LANGUAGE-TRANSLATE-MODEL": "20.0.0",
"FIREBASE-ML-NATURAL-LANGUAGE-SMART-REPLY-MODEL": "20.0.0",
"FIREBASE-ML-MODEL-INTERPRETER": "20.0.0",
"FIREBASE-ML-VISION-AUTOML": "17.0.0",
"FIREBASE-PERF": "18.0.0",
"FIREBASE-DATABASE": "18.0.0",
"FIREBASE-CONFIG": "18.0.0"
},
"cordova-android-play-services-gradle-release": {
"PLAY-SERVICES-ADS": "18.0.0",
"PLAY-SERVICES-ADS-IDENTIFIER": "17.0.0",
"PLAY-SERVICES-ADS-LITE": "18.0.0",
"PLAY-SERVICES-AFS-NATIVE": "17.0.0",
"PLAY-SERVICES-ANALYTICS": "17.0.0",
"PLAY-SERVICES-ANALYTICS-IMPL": "17.0.0",
"PLAY-SERVICES-APPINVITE": "18.0.0",
"PLAY-SERVICES-AUDIENCE": "17.0.0",
"PLAY-SERVICES-AUTH": "17.0.0",
"PLAY-SERVICES-AUTH-API-PHONE": "17.0.0",
"PLAY-SERVICES-AWARENESS": "17.0.0",
"PLAY-SERVICES-BASE": "17.0.0",
"PLAY-SERVICES-BASEMENT": "17.0.0",
"PLAY-SERVICES-CAST": "17.0.0",
"PLAY-SERVICES-CAST-FRAMEWORK": "17.0.0",
"PLAY-SERVICES-CLEARCUT": "17.0.0",
"PLAY-SERVICES-CRONET": "17.0.0",
"PLAY-SERVICES-DRIVE": "17.0.0",
"PLAY-SERVICES-FIDO": "18.0.0",
"PLAY-SERVICES-FITNESS": "17.0.0",
"PLAY-SERVICES-FLAGS": "17.0.0",
"PLAY-SERVICES-GAMES": "18.0.0",
"PLAY-SERVICES-GASS": "18.0.0",
"PLAY-SERVICES-GCM": "17.0.0",
"PLAY-SERVICES-IDENTITY": "17.0.0",
"PLAY-SERVICES-IID": "17.0.0",
"PLAY-SERVICES-INSTANTAPPS": "17.0.0",
"PLAY-SERVICES-LOCATION": "17.0.0",
"PLAY-SERVICES-MAPS": "17.0.0",
"PLAY-SERVICES-MEASUREMENT": "17.0.0",
"PLAY-SERVICES-MEASUREMENT-API": "17.0.0",
"PLAY-SERVICES-MEASUREMENT-IMPL": "17.0.0",
"PLAY-SERVICES-MEASUREMENT-SDK": "17.0.0",
"PLAY-SERVICES-MEASUREMENT-SDK-API": "17.0.0",
"PLAY-SERVICES-NEARBY": "17.0.0",
"PLAY-SERVICES-OSS-LICENSES": "17.0.0",
"PLAY-SERVICES-PANORAMA": "17.0.0",
"PLAY-SERVICES-PHENOTYPE": "17.0.0",
"PLAY-SERVICES-PLACES": "17.0.0",
"PLAY-SERVICES-PLACES-PLACEREPORT": "17.0.0",
"PLAY-SERVICES-PLUS": "17.0.0",
"PLAY-SERVICES-SAFETYNET": "17.0.0",
"PLAY-SERVICES-STATS": "17.0.0",
"PLAY-SERVICES-TAGMANAGER": "17.0.0",
"PLAY-SERVICES-TAGMANAGER-API": "17.0.0",
"PLAY-SERVICES-TAGMANAGER-V4-IMPL": "17.0.0",
"PLAY-SERVICES-TASKS": "17.0.0",
"PLAY-SERVICES-VISION": "18.0.0",
"PLAY-SERVICES-VISION-COMMON": "18.0.0",
"PLAY-SERVICES-VISION-IMAGE-LABEL": "18.0.0",
"PLAY-SERVICES-WALLET": "17.0.0",
"PLAY-SERVICES-WEARABLE": "17.0.0"
},
"cordova-android-support-gradle-release": {
"ANDROID_SUPPORT_VERSION": "27.+"
},
"cordova-plugin-appsflyer-sdk": {},
"cordova-plugin-radar": {},
"cordova-plugin-androidx-adapter": {},
"@havesource/cordova-plugin-push": {
"ANDROID_SUPPORT_V13_VERSION": "28.0.0",
"FCM_VERSION": "18.+"
}
},
"platforms": [
"ios",
"android"
]
}
--- End of Cordova JSON Snippet ---

Logs taken while reproducing problem

V/AlarmManager(31697): set(PendingIntent{41b658f: PendingIntentRecord{63d09f0 com.google.android.gms broadcastIntent}}) : type=2 triggerAtTime=2333028103 win=0 tElapsed=2333028103 maxElapsed=2333028103 interval=0 flags=0xd I/SendBroadcastPermission(31419): action:com.google.android.c2dm.intent.RECEIVE, mPermissionType:0 I/SendBroadcastPermission(31419): action:com.google.android.c2dm.intent.RECEIVE, mPermissionType:0 W/GCM (31419): broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg=com.some.id (has extras) }

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

1 participant