I am trying to use Urban Airship to send/ receive push notification in my iOS app.
I have created one application, added the urban airship library to that project. I have set the development app key and the app secret key by adding Airshipconfig.plist file in my project. In appdelegate class, I have added the code to register for notification. Now, when I run the application, the device token gets registered in the urban airship dashboard in Audience -- > Device Tokens tab.
But now I want to send the push notification from the dashboard to my iPhone. I did this by clicking
Messages --> Messages Overview --> Message
When I do this, this send the notification to my iPhone.
But there are many questions I dont' understand about urban airship
I have created the application in development mode, Is it compulsory
to create an application to production mode also because in
Airshipconfig.plist, it asks to write the production app key and
production secret key also.
In the error console I am getting the message, "No activedevice tokens found", why?
What is the difference between PushMessage and Message in Messages --> Messages Overview option
I have created the application in development mode, Is it compulsory to create an application to production mode also because in Airshipconfig.plist, it asks to write the production app key and production secret key also.
Never mix these two. This is most likely your issue. Your app is registering a development device token to a production application. Create a new app in UA's dashboard for each environment:
production > production
development > development
http://docs.urbanairship.com/build/ios.html#production-vs-development-apps-in-urban-airship
In the error console I am getting the message, "No activedevice tokens found", why?
Probably because of the reason above. Otherwise, are you being prompted to receive push when you open the app?
http://docs.urbanairship.com/build/ios.html
What is the difference between PushMessage and Message in Messages --> Messages Overview option
no idea what this is referencing.. Screen shot?
Related
I created a Amazon Pinpoint project using a production certificate from my Apple developer account, I configured my Xcode project with the project ID and APS environment equal to 'production' , I upload the app to TestFlight and then install it in my device, when I send a message using the 'Test messaging' Amazon Pinpoint option (using an specific Endpoint Id or Device Token) the push notification is sent and received in my device, but when I launch a Campaign everything looks ok but I never received the push notification in my device, regardless that the segment I choose is dynamic and shows 1 eligible endpoint (I assume is mine because only I have installed this version).
Can anyone shed any light on this? Thanks in advance!
P.D: In the development environment both works, the message to specific device and the campaign.
UPDATE: I've research in all Amazon pinpoint documentation and is unclear the solution and in other posts from AWS forums and stackoverflow I found that the solution is use the APNs Production certificate and I've already done this.
I found that this line of code in the function didFinishLaunchingWithOptions, the debug mode was always in true:
// Enabling app to receive push notification from Amazon Pinpoint
// Instantiate Pinpoint
let pinpointConfiguration = AWSPinpointConfiguration
.defaultPinpointConfiguration(launchOptions: launchOptions)
// Set debug mode to use APNS sandbox, make sure to toggle for your production app
pinpointConfiguration.debug = false
pinpoint = AWSPinpoint(configuration: pinpointConfiguration)
So the device could not be able to receive the remote notification from Amazon pinpoint
I am trying to determine what I need to do with respect to the combination of APNS endpoint (e.g., development or production), Xcode, and Apple Push certificates in order to test push notifications while in development. I feel like I've tried every possible combination, but I must be missing something ...
Background
When using Apple's HTTP/2 APNS endpoints from my "dispatch" server, my app/device does not receive pushes, and I receive a BadDeviceToken response from Apple.
Using the exact same .p12 certificate and deviceToken with the Pusher macOS testing app (which uses legacy APNS endpoints), the pushes successfully deliver.
To complicate this further ...
When using Apple's HTTP/2 APNS endpoints from my "dispatch" server for PassKit pushes, my pass/device does receive pushes.
So ...
Point #3 tells me that my "dispatch" server must be configured properly, because pushes to the Apple Wallet pass cause a response (e.g., I can see follow-on requests to my server's endpoints from the Wallet / the pass).
That said, Apple Wallet is a "Production" app. I suspect that, because my app (from Point #1) is non-production/development, something is different.
.
Question
Has anyone been able to successfully receive -- in Xcode -- push notifications sent to Apple's api.development.push.apple.com endpoint? Can you outline the steps you performed (which certificate from developers.apple.com, etc.)? Thank you!
You should be able to send development push from server:
You need to connect to api.development.push.apple.com:443 instead of api.push.apple.com:443. You can use production certificate for both.
Sending push to production server can not work with development builds - only with a build that is exported with AppStore configuration, but you can't debug those (at least not with Xcode)
If you need to check whether the production endpoint works, you can use testflight
Set development certificate from apple developer portal.
Use either production/test server for communicating with APNS.
Edit your target scheme as follows :
This will ensure that when push notification arrives, control will itself fall in the code. It might seem confusing. But here it is how it works :
- Install app on device and stop the Run process from Xcode.
- Place a breakpoint on didReceiveRemoteNotification.
- Send a push notification to device.
- Xcode will itself start the app and control will go to the above function.
I am trying to send a PUSH message to iOS using the Firebase. APNS certificate has been set up for the development and production, and It is confirmed that the remote message can be received. I think there is no way to send a message only for development in Firebase Console.
Not directly, there is no dev vs prod switch in the message composer.
One option is to have dev builds subscribe to topics with a _dev appended to them then only send to the _dev topics when developing.
As discussed above, you cannot send directly without knowing which devices are having development build or having production build.
What you can try is
Based on the scheme you are running/releaseing, set a firebase property, say isDevBuild, with values Yes for dev builds and No for prodbuild.
This property will be available for you in firebase console when you are composing the notification message.
Based on user-property if you set the property as Yes, the notification will be sent to all devices which has a dev build.
or
Create a separate firebase project for dev and prod.
This will help you in separating all your dev info (analytics, notification info) with prod info.
Hope this helps.
I'm trying to test Push Notifications on an app which has been developed by other team. We have the app installed in our device and validated (the app is no yet in the App Store).
Connection parameters with APNS server are ok.
We launch our script to execute the Push Notification but we don't receive any notification in our device/app.
Question:
There are any log or trace in APNS of our demands?
Have APNS any history of the Notifications sended and its status ?
Note : We use Adobe Campaign to generate Push Notifications services.
We've tested the flux with an alpha version of the app and worked but now with a RC candidate doesn't work.
Thanks in advance
I recommend to check all these possibilities:
Notification is not sent from server
Try to log apns response to see if this is the issue
Check if apple certificates used are expired
Check if you're sending notification using development or production certificates with the right gateway. As Apple say:
The binary interface of the production environment is available through gateway.push.apple.com, port 2195; the binary interface of the development environment is available through gateway.sandbox.push.apple.com, port 2195.
Notification is sent from server but is not received by device
Check in settings if push notification are enabled for your app
Check if some code is hiding the notification when the app is in foregroud or is working in background
Check if you have installed the right environment application (if you send notification for production you won't receive nothing in a development build of the app)
Check the device token used to send notification
Did your app communicate to your server that it is a staging app and that the script should send APN via the Apple staging server?
Did you also deploy staging certs/keys to your server?
Did you log the response you got from the APN server when your server communicated with it?
Use APN Tester app save my day, thanks "sanandiya viper".
The problem was app's developers don't tell us p12 certificate is production one and we installed it as developer certificate. APN Tester bring us the choice to test booth options.
Thanks for all your answer. Problem solved.
We added receiving push notifications to an iPhone app. Everything was working in the test/sandbox environment, we were getting token id's from the app and could send push notifications from our server.
But now the app is approved and came out of the Appstore we were getting empty push tokens/notifications id's send to our server. We already have over 600 of them... Note that end users do get the popup to approve of receiving notifications in the app, the app is just sending empty tokens to our server after approval. So probably empty tokens are handed out by the APNS server.
The following issue showed us that this is probably due to missing 'push notification' entitlement in the provisioning profile we used to make the build for the app store:
How do I check if an iOS distribution provisioning profile has push notifications enabled?
The missing entitlement was due to a bug in Apple's provisiong protal website, but after 'Modify any existing profile before you download the new one' as mentioned in the following article
http://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/ProvisioningDevelopment/ProvisioningDevelopment.html
We now have the correct entitlement in our .mobileprovision file:
<key>Entitlements</key>
<dict>
..
<key>aps-environment</key>
<string>production</string>
..
So we are rebuilding our app and adding it to the store. And hoping to get push notifications then.
I hope the above might help some others. But now to get to my actual question: Will we start receiving new push tokens also for the 600+ users that already downloaded the current version when they install the next update out of the store? Or do we need to add some initial code to our app? The registerForRemoteNotifications method is right now only called on application startup. Will it also be triggered when the push token id is changed from empty ('') to an actual token? Of course we do not want to wait another (small) week for the new AppStore approval and only then find out that push notification still aren't working for some users. I'm hoping some expert out there can tell us.
Note: We are using an iPhone app developed in MonoTouch, and using the (old) APNS-Sharp library to send the notifications from our server, but I don't think those details are relevant for this issue.
When those 600+ users install the next update and run the application again, your application will call registerForRemoteNotifications (since you said you call it on startup), and will get the non empty device token (when application:didRegisterForRemoteNotificationsWithDeviceToken: is called).
Apple state in their docs that you should always call this method at startup instead of using a cached copy of the device token, because the device token is not guaranteed to remain the same. So you shouldn't have any problem.
Here's the relevant quote from the APNS docs :
An application should register every time it launches and give its
provider the current token. It calls
the registerForRemoteNotificationTypes: method to kick off the
registration process. The parameter of this method takes a
UIRemoteNotificationType (or, for OS X, a NSRemoteNotificationType)
bit mask that specifies the initial types of notifications that the
application wishes to receive—for example, icon-badging and sounds,
but not alert messages. In iOS, users can thereafter modify the
enabled notification types in the Notifications preference of the
Settings application. In both iOS and OS X, you can retrieve the
currently enabled notification types by calling the
enabledRemoteNotificationTypes method. The operating system does not
badge icons, display alert messages, or play alert sounds if any of
these notifications types are not enabled, even if they are specified
in the notification payload.
This is also relevant :
By requesting the device token and passing it to the provider every
time your application launches, you help to ensure that the provider
has the current token for the device. If a user restores a backup to a
device or computer other than the one that the backup was created for
(for example, the user migrates data to a new device or computer), he
or she must launch the application at least once for it to receive
notifications again. If the user restores backup data to a new device
or computer, or reinstalls the operating system, the device token
changes. Moreover, never cache a device token and give that to your
provider; always get the token from the system whenever you need it.
If your application has previously registered, calling
registerForRemoteNotificationTypes: results in the operating system
passing the device token to the delegate immediately without incurring
additional overhead.