flurry / flurry-android-sdk

Flurry Android SDK API reference documentation
Apache License 2.0
21 stars 3 forks source link

Push campaign not received #35

Open DinaMMorad opened 1 year ago

DinaMMorad commented 1 year ago

when I send push campaign to test device token it works but when I start campaign I don't receive the notification

poting-oath commented 1 year ago

@DinaMMorad Android 12 & 13 changed many Notification policies. These may be the reasons why you did not receive the notification on devices that run on newer Android platforms.

Flurry SDK 14.2.0 resolved these issues on these newer Android platforms. Please upgrade Flurry SDK to see whether it resolves your issues or not.

https://developer.yahoo.com/flurry/docs/releasenotes/android/ Android SDK Release Notes Version 14.2.0 - 03/14/2023

All add the post notification permission to the manifest file: (required by Android 13) uses-permission android:name=”android.permission.POST_NOTIFICATIONS”

DinaMMorad commented 1 year ago

@poting-oath I'm using version 14.2.0 and I've got POST_NOTIFICATIONS permission but didn't receive notification on android 13 device although I received it with android 10 device

DinaMMorad commented 1 year ago

@poting-oath also I added user property and sent notification to it but didn't receive that notification I wanted to target all users using english language with a notification I sent notification but all devices that has this userproperty didn't receive this notification

poting-oath commented 1 year ago

@DinaMMorad Though the Android developer docs say "recommended" to add POST_NOTIFICATIONS permission for Android 13 and above devices. As I found, it is actually "required" to add this permission! Please do add the following post notification permission to the manifest file:

uses-permission android:name=”android.permission.POST_NOTIFICATIONS”

And in your app, do use ActivityCompat.requestPermissions to request the permission if ContextCompat.checkSelfPermission returns PackageManager.PERMISSION_DENIED. Examples codes,

    private static List<String> PERMISSIONS;
    static {
        PERMISSIONS = new ArrayList<>();
        PERMISSIONS.add(Manifest.permission.ACCESS_FINE_LOCATION);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
            PERMISSIONS.add(Manifest.permission.POST_NOTIFICATIONS);
        }
    }
...
    for (String permission : PERMISSIONS) {
        if (ContextCompat.checkSelfPermission(this, permission) == PackageManager.PERMISSION_DENIED) {
            // Simply request permissions if one of them is missing
            ActivityCompat.requestPermissions(this, PERMISSIONS.toArray(new String[0]), PERMISSION_REQUEST);
            break;
        }
    }
raghuriyaz commented 11 months ago

@DinaMMorad @poting-oath I'm seeing the same issue. push notification works with test device token but if I start a campaign, it is not received. Did you find any solution?

poting-oath commented 11 months ago

@raghuriyaz Do you add permission ”android.permission.POST_NOTIFICATIONS” to your app? And ask users to allow the permission by ActivityCompat.requestPermissions?