I'm using Netmera SDK in my app. And it's prompting user's permission for Push notifications right after app launches. How to control that behaviour and ask user's permission after he will log in inside my app?
Adding or removing [Netmera setApiKey:kNetmeraAPIKey];
line has no effect.
Even removing all dependencies to <Netmera/Netmera.h>
has no effect.
Looks like Netmera SDK injecting calling registerUserNotificationSettings:
method somehow... I don't know.
Is there any workaround that could be made for this?
Asked
Active
Viewed 164 times
1

ZigDanis
- 154
- 1
- 11
1 Answers
2
There is currently not an easy way to do this. In the next major release, there will be a much better permission management flow :)
However, for now you could do the following:
Add category declaration to NMPushManager+DisablePushOnLaunchHack.h file:
#import <Netmera/Netmera.h>
@interface NMPushManager (DisablePushOnLaunchHack)
@end
Add category implementation to NMPushManager+DisablePushOnLaunchHack.m file:
#import "NMPushManager+DisablePushOnLaunchHack.h"
@implementation NMPushManager (DisablePushOnLaunchHack)
+ (void)setEnabledUserNotificationTypesInternal:(UIUserNotificationType)type{
// Do nothing.
}
@end
Lastly, you should add #import "NMPushManager+DisablePushOnLaunchHack.h"
into your AppDelegate class in order to prevent Netmera to automatically register to push notifications.
After that, you can prompt permission alert to user whenever you want using the following code:
// You can set a different UIUserNotificationType combination
[NMPushManager setEnabledUserNotificationTypes:(UIUserNotificationTypeAlert |
UIUserNotificationTypeSound |
UIUserNotificationTypeBadge)];

manuyavuz
- 176
- 1
- 11