How to unsubscribe push notification from first vendor in iOS - ios

In my last version of my Application I used Appoxee to send push notification and in my current version, I wanted to switch to UrbanAirShip so I removed Appoxee from the code and integrated UrbanAirShip.
Now when I upgrade the app, I still receive the push notification from appoxee.
I want my old users (using old version of my app) to receive push notification from appoxee and new users (who is on my latest version) to receive only from UrbanAirShip. How to unsubscribe push notification from first vendor

You should be looking at Apple's documentation on how to unregister from the existing provider, i.e. by calling unregisterForRemoteNotifications on the UIApplication object.
After you've unregistered, you will have to call the registration for remote notification again and at this point pass in the details for Urban Airship.
From what I understand, the user shouldn't be prompted to approve again, it will just use the existing approval settings for the app.

Related

OneSignal subcribers not updating after switching from Pushwoosh

I have an app which had 7,000 users subscribed on Pushwoosh. We switched from Pushwoosh to OneSignal and updated our app with OneSignal documentation. New users downloading our app are getting subscribed to our push notifications but the old ones are not getting updated.
Do we have to trigger permission to send push notification again ? Does Apple allow to do so ?
What is the workaround this ?
Notification Permissions & APNs Token
Notification permission is granted at the app level, so no matter what SDK / library is in your app it can read if the user has already accepted notifications and the APNs token.
The OneSignal iOS SDK does automatically check if permission is already granted and attempts to register for an APNs token. The OneSignal SDK will register the device with the app_id you put in your app and create a new player if it is the first time you opened the app since you added OneSignal.
APNs will return the same push token each time unless the user has fully uninstalled and reinstalled your app. However just in-case Apple were to deiced to rotate the token the OneSignal SDK does call the APNs register API to be sure.
Finding & Fixing The Issue
To find the issue I recommend the following;
Only include one push notification SDK in your app at a time, it possible for SDKs to have conflicts due to method swizzling or other possible issues.
In this case remove the Pushwoosh SDK if you using OneSignal.
Try to reproduce the issue on a test device by upgrading your app.
When testing the upgrade, I recommend enabling verbose logging in the OneSignal SDK.
OneSignal.setLogLevel(.LL_VERBOSE, visualLevel: .LL_NONE)
Also observe at this point if you are getting a user on the OneSignal dashboard.
If there was an issue getting an APNs token by the OneSignal SDK there will still be a user, they will just show as unsubscribed with details why.
This all depends on how you are getting the device push token from the user's device and sending it to OneSignal. A common mistake is to only get the device token the first time the user accepts the notification permission prompt. However, the device push token is subject to change randomly at any point in the future which can result in outdated device push tokens on the server used to send notifications.
To combat this, it is suggested to register for push notification every time the user launches the app. While this won't re-prompt them to accept notification permissions, it will fetch the device push token again. The push service you are using should then be updated with the new device token.
TL;DR: at every app launch register for a device push token and send it to your push server.

Sending all users push notification in ios

I want to send push notification to all users who is installed my iOS app. Can you tell me the best and easy process for this?I want to send push without storing or using any specific device token. It will work for all users. I'm using FCM for this but for user segment i don't get push notification. For single device by given fcm token it's working fine.
If you want to send push notification manually to everyone who has your app installed already you should use Firebase cloud messaging.
You can read more here: https://firebase.google.com.
If you find this answer useful/correct, please mark it as correct.

Unregister remote notification on logout

About unregisterForRemoteNotifications
From the apple doc
You should call this method in rare circumstances only, such as when a new version of the app removes support for all types of remote notifications. Users can temporarily prevent apps from receiving remote notifications through the Notifications section of the Settings app. Apps unregistered through this method can always re-register.
Some are saying:
Calling it would at times put the app in a state where calling
registerForRemoteNotifications would no longer work.
Why did apple tell us to use it in rare circumstances only and gave such an extreme example of if new version of app removes push notification support completely. Isn't it fit for the logout button action?
In our app users can login with multiple devices. It would be lot easier if unregisterForRemoteNotifications works well. Anybody using unregisterForRemoteNotifications on logout button?
Yes, You can use unregisterForRemoteNotifications on Logout.
This function is used to unregister all the notification from Apple Store.
You always can re register to notification with registerForRemoteNotifications and start receiving the push notification. And that you may need to do it in your success Login.
If you read that sentence from Apple Doc carefully than its last line clearly says that Apps unregistered through this method can always re-register.
They are suggesting developers if they dont want to receive push notification for some time than they can just simply disable from the settings. But for login and logout session you are doing right with by calling unregisterForRemoteNotifications
And New version will stop receiving notification means after your logout you will never receive any notification till you re register for it.

How to start an iOS push notification from an in-app process

I'm building an app that plugs into a third-party service that will send messages to the iOS device. So far I've been unable to find any documentation on then starting off a push notification when the delegate method is fired to say that a new message has been received.
So far, I've got the app registering to receive push notifications and the delegate method firing, I'm just not sure how to connect the two together?
The app will have a minimum deployment of iOS 5.1 if that helps.
This is not how remote notifications work. Their main purpose is to notify application about some event. So application only receives remote notifications and note send them. So scenario is:
App is notified via
application:didReceiveRemoteNotification: //if running
or
application:didFinishLaunchingWithOptions: //if closed
According to notification payload you determine what exact action you need to perform. For example notification says that a new message was sent to the user. Then you need to send your custom request to the your server and get that new message.
I've discovered that in this case it is not push notifications that I want but local notifications instead.

iOS Push Notifications Question

I have never coded an App with Push Notifications, and I have a very general question. Does the publisher of the App have control to push out a notification whenever they want after the App is released on the App store? I mean, for example, if an App has push notifications enabled, is there some sort of dashboard somewhere where the App developer can instantaneously push out a notification to everyone that has downloaded the App? (Assuming they have push notifications enabled)
If your app supports Push Notifications, you have to provide your own server that communicates with Apple's push infrastructure. You can implement whatever sort of dashboard you want in your server. (In lieu of actually providing this yourself, you could also use a third-party provider such as Urban Airship.)
An overview of how your provider interacts with Apple's service is here: http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ApplePushService/ApplePushService.html

Resources