0

How can I check if the user denied or accepted the push notification permission message in ios in codenameone or native?

Duran k
  • 91
  • 6

2 Answers2

0

Both Android and iOS have API's to detect if push is enabled: Push Notification ON or OFF Checking in iOS

Android 4.1: How to check notifications are disabled for the application?

Since those were added relatively recently and we didn't get enough demand for that we don't support them at this time. You can probably invoke them with a native interface or submit a pull request with integration. Normally you would get a push registered callback when push works and an error or nothing if it doesn't.

Shai Almog
  • 51,749
  • 5
  • 35
  • 65
0

I found a solution implementing a funtion native to IOS 10

This methods are working perfectly in Objective-c and codenameone code

//------------------------------------------------------------------------------
//This method is use to check if the user enable or disable push notification
//------------------------------------------------------------------------------
-(BOOL)isPushNotificationIsEnable{

    if ([[UIApplication sharedApplication] isRegisteredForRemoteNotifications]) {
        NSLog(@"isPushNotificationIsEnable()->YES");
        return YES;
    } else {
        NSLog(@"isPushNotificationIsEnable()->NO");
        return NO;
    }
}
//------------------------------------------------------------------------------
//This method is use to launch the Notification screen of your app
//------------------------------------------------------------------------------
Display.getInstance().execute("App-Prefs:root=NOTIFICATIONS_ID&path=your package name app", new ActionListener() {
     String methodName = "startLocationSetting";
      @Override
      public void actionPerformed(ActionEvent evt) {

            boolean status = Utils.isPushNotificationEnable();

      }

});
//------------------------------------------------------------------------------
Duran k
  • 91
  • 6