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

[issue]: android 12+ some users like relame , oppo not able to subscribe in onesignal they count in subscription record only not count in sunscriber #959

Open
2 of 3 tasks
Techsol45 opened this issue Sep 30, 2024 · 0 comments

Comments

@Techsol45
Copy link

What happened?

5.1.22

below android 12+ its work perfectly but above android 12+ its not able to subscribe user.

image

Steps to reproduce?

please help to fix it:

What did you expect to happen?

please give solution:

OneSignal Flutter SDK version

5.1.22

Which platform(s) are affected?

  • iOS
  • Android

Relevant log output

here is my code:


// OneSignal Initialization
Future<void> initPlatformState() async {
  OneSignal.Debug.setLogLevel(OSLogLevel.verbose);
  OneSignal.Debug.setAlertLevel(OSLogLevel.none);

  // Replace with your OneSignal App ID
  OneSignal.initialize("xxxxxxxxxxxxxxxxxxxxxxxxxx");

  // Android 13+ permission handling
  if (io.Platform.isAndroid && io.Platform.operatingSystemVersion.contains('13')) {
    bool? status = await OneSignal.Notifications.requestPermission(true);
    print("Notification permission granted: $status");
  }

  // Additional OneSignal configurations
  OneSignal.LiveActivities.setupDefault();
  OneSignal.Notifications.clearAll();

  bool? allowed = await OneSignal.Notifications.requestPermission(true);
  print('Notifications allowed: $allowed');

  // Observe push subscription
  OneSignal.User.pushSubscription.addObserver((state) {
    print(OneSignal.User.pushSubscription.optedIn);
    print(OneSignal.User.pushSubscription.id);
    print(OneSignal.User.pushSubscription.token);
    print(state.current.jsonRepresentation());
  });

  // Handle notification click
  OneSignal.Notifications.addClickListener((event) {
    print('Notification Clicked: ${event.notification.jsonRepresentation()}');
  });

  // Handle foreground notifications
  OneSignal.Notifications.addForegroundWillDisplayListener((event) {
    event.preventDefault(); // Prevent the default notification display
    event.notification.display(); // Display manually
    print('Foreground Notification: ${event.notification.jsonRepresentation()}');
  });

  // In-app messages click listener
  OneSignal.InAppMessages.addClickListener((event) {
    print('In-App Message Clicked: ${event.result.jsonRepresentation()}');
  });
}

Code of Conduct

  • I agree to follow this project's Code of Conduct
@Techsol45 Techsol45 changed the title [Bug]: android 12+ some users like relame , oppo not able to subscribe in onesignal they count in subscription record only not count in sunscriber [issue]: android 12+ some users like relame , oppo not able to subscribe in onesignal they count in subscription record only not count in sunscriber Sep 30, 2024
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