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

Notification Pop-up does not appear on Android > 13 #1871

Closed
noxism opened this issue Oct 31, 2023 · 3 comments
Closed

Notification Pop-up does not appear on Android > 13 #1871

noxism opened this issue Oct 31, 2023 · 3 comments

Comments

@noxism
Copy link

noxism commented Oct 31, 2023

Bug Report

Plugin(s)

"@capacitor/push-notifications": "^4.1.2"

Capacitor Version

➜ git:(main) npx cap doctor
πŸ’Š   Capacitor Doctor  πŸ’Š 

Latest Dependencies:

  @capacitor/cli: 5.5.1
  @capacitor/core: 5.5.1
  @capacitor/android: 5.5.1
  @capacitor/ios: 5.5.1

Installed Dependencies:

  @capacitor/ios: not installed
  @capacitor/cli: 4.7.1
  @capacitor/core: 4.7.1
  @capacitor/android: 4.7.1

[success] Android looking great! πŸ‘Œ

Platform(s)

Android > 13

Current Behavior

After uploading the app on playstore the notification popup does not appear on Android > 13

Expected Behavior

The user should see the notification popup in order to accept or not the notifications.

Code Reproduction

const registerNotifications = async () => {
    let permStatus = await PushNotifications.checkPermissions();

    if (permStatus.receive === 'prompt') {
        permStatus = await PushNotifications.requestPermissions();
    }

    if (permStatus.receive !== 'granted') {
        throw new Error('User denied permissions!');
    }

    await PushNotifications.register();
}

Also we tried with, without any luck to see the notification popup

const registerNotifications = async () => {
    let permStatus = await PushNotifications.checkPermissions();
    permStatus = await PushNotifications.requestPermissions();
    await PushNotifications.register();
}

Other Technical Details

When we test the code with APK Debug, the users can see the notification popup normally. But when we build and upload an AAB to playstore, the users see nothing and the notifications are turned off on app info.

Additional Context

The permission that we have tried so far:
<?xml version="1.0" encoding="utf-8" ?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.careacross.bc">
    <uses-permission android:name="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE" />
    <uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
    <uses-permission android:name="android.permission.VIBRATE" />
    <uses-permission android:name="android.permission.WAKE_LOCK" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">...
The google-service.json file
{
  "project_info": {
    "project_number": "******",
    "firebase_url": "https://careacross-notifications.firebaseio.com",
    "project_id": "careacross-notifications",
    "storage_bucket": "careacross-notifications.appspot.com"
  },
  "client": [
    {
      "client_info": {
        "mobilesdk_app_id": "1:******",
        "android_client_info": {
          "package_name": "com.careacross.bc"
        }
      },
      "oauth_client": [
        {
          "client_id": "******",
          "client_type": 3
        }
      ],
      "api_key": [
        {
          "current_key": "******"
        }
      ],
      "services": {
        "appinvite_service": {
          "other_platform_oauth_client": [
            {
              "client_id": "******",
              "client_type": 3
            }
          ]
        }
      }
    },
    {
      "client_info": {
        "mobilesdk_app_id": "1:******",
        "android_client_info": {
          "package_name": "com.careacross.bc"
        }
      },
      "oauth_client": [
        {
          "client_id": "******",
          "client_type": 3
        }
      ],
      "api_key": [
        {
          "current_key": "******"
        }
      ],
      "services": {
        "appinvite_service": {
          "other_platform_oauth_client": [
            {
              "client_id": "******",
              "client_type": 3
            }
          ]
        }
      }
    }
  ],
  "configuration_version": "1"
}

Note: Using APK Debug the user can see the notification popup but this is not happening when we upload the AAB to the App Store.

Any thoughts, about what is going wrong?

Thanks
Chris

@jcesarmobile
Copy link
Member

For properly targeting android 13 and newer you have to use capacitor 5 and capacitor 5 plugins, you are still on capacitor 4 and push plugin v4, which doesn’t properly handle the notification prompt, you need to update.

@jcesarmobile jcesarmobile closed this as not planned Won't fix, can't repro, duplicate, stale Nov 1, 2023
@noxism

This comment was marked as abuse.

Copy link

ionitron-bot bot commented Nov 22, 2023

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of the plugin, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants