How can I check if the user denied or accepted the push notification permission message in ios in codenameone or native?
Asked
Active
Viewed 431 times
0
-
1Please do not go ALL CAPS on us. – user189035 Jul 06 '17 at 16:53
-
I would be remiss if i didn't ask you but: have you tried to write that same question on google first? – Bolza Jul 06 '17 at 17:06
-
yes, I found so much but in codenameone it don't appear nothing related – Duran k Jul 06 '17 at 17:08
2 Answers
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