Ionic push notification in production mode


#1

I’m trying to implement ionic push notifications as it says in ionic tutorial. In development mode I received notification, that was shown as alert. But building app with production SSL cert and distribution provision profile only sends notification, but not delivers to iPhone (message status is ‘success’). The app is installing via Testflight. Does anybody faced the same problem and how to solve it?


#2

I am having the same problem with production mode.


#3

Hi, @dponrals, my app works like a charm, all I needed is to wait for notification. Because the first push was not recieved immediately (like android does)


#4

Did you remove the app build with the dev certs from your device?
Did you change the certs also in the pushnotification settings of ionic?

BTW: the service is in alpha phase… i would use other services until ionic releases the final.


#5

I use prod setting for ionic and load the app to device as Ad Hoc archive


#6

Created and then Uploaded APNs Production Cert to ionic. Used custom Provisioning Profile built for this app. Ran the following

ionic push --production-mode=y

My device registers just fines and identifies itself, then went to https://apps.ionic.io/app/a3115002/push/tools and pushed a notification to my devices token, but nothing happens and the queue tells me it sent it.

App Settings

  $ionicAppProvider.identify({
    dev_push: false,
    app_id: 'a3115002',
    api_key: public_key
  });

Push Settings

$ionicUser.identify({
    user_id: user.$id,
    serial: user.serial
})
.then(function(){
  registerForPush(user);
});

function registerForPush (user) {
  $ionicPush.register({
    canShowAlert: true, 
    canSetBadge: true,
    canPlaySound: true,
    canRunActionsOnWake: true,
    onNotification: function(notification) {
      alert(notification);
    }
  });
}

Am I missing something?


#7

@bengtler You can remove the app from the device, but this didn’t help me.

There are 2 scenarios for me:

  • using ‘dev_push’ option as $ionicAppProvider.identify({ ..., dev_push: true, ... }) and dev ssl cert running ionic push --production-mode=n. This will show notification dev notification.

  • archiving app for Ad Hoc distribution and install via iTunes to your connected device. Also use prod ssl cert by ionic push --production-mode=y. This will show notification prod notification.


#8

@dponrals, code looks fine. Seems that push notifications are not sending from ionic dashboard. Try to send notification via curl or even implement request to ionic push server from your backend.


#9

I am using 2 scenarios:

  1. dev mode:
    Pass 'dev_push': true to $ionicAppProvider.identify()
    Switch to dev ssl cert by ionic push --production-mode=n
    Send push notification via curl

  2. prod mode:
    Archive app for Ad Hoc development using custom xcode provision profile and install app to your connected device via iTunes.
    Switch to prod ssl cert by ionic push --production-mode=y
    Send push notification via curl


#10

Thanks @Jukov for getting back to me. I tried doing curl and even tried using https://www.npmjs.com/package/ionic-push-server but had no luck. I went throught he following steps:

  • Archived the app for ad hoc development.
  • Used provisioning profile that automatically gets created by Xcode, I checked the panel for iOS Provisioning Profiles and the profile has listed Enabled Services: Game Center, In-App Purchase, Push Notifications.
  • Exported the Archive to an IPA on to my desktop
  • Copied IPA to iTunes
  • Switch to prod ssl cert by ionic push --production-mode=y
  • Send push notification via curl

The thing is that I know it’s correctly registering the device for push, because it sends that device token to my Firebase instance.


#11

@dponrals, all your steps are correct. One difference, is that I don’t use $ionicUser.identify(). Can you call only $ionicPush.register()? Also my first push notification got some time to arrive.


#12

@Jukov are you setting dev_push false, or are you removing it from $ionicAppProvider.identify

Also have you tried using TestFlight? Is iTunes the only way you’ve gotten Production to work?


#13

@Jukov Again, Thanks for the help. I haven’t been able to get anyone on gitter.im to help me out with this issue.

I don’t think the register is part of the problem, as I get the device registered and I receive the device token, however I switched it to identify the user with the $ionicPush.register() call. Still nothing…

So I switched back to development mode, and the dev pushes work fine. I created a new production cert and went through the steps over to get it uploaded to Ionic, switched everything back to production mode, aaaaaaaaand nothing. What’s interesting is that when it’s in production mode, I can still send notifications to my dev devices.


#14

@dponrals, I removed dev_push at all and also successfully installed app via TestFlight.


#15

We are having this same issue and it’s very frustrating! Still haven’t solved it :frowning:


#16

Got the exact same issue - @max @bradleyjoyce

Dev fine, production not.

If this is a known issue for Ionic Push, can you let us know - we have users going live next week and this has to work for us. Please let me know.


#17

we ended up not using Ionic Push at all… instead, we’re using the ZeroPush service


#18

Same problem here… Everything worked just fine in development but now I downloaded the app from the App Store and push don’t arrive to iOS devices. Neither curl nor ionic admin console (even though the “check message status” in the console says the push was sent successfully).
And yes, I did ionic push --production-mode=y.

Android devices get push notifications just fine in production.

I’m going live next week, please, let us know what’s the problem!


#19

Im having the same issue. Production push certificate, provisioning profile all are fine (the XC: one). Pushes say theyre sent but nothing is received. Recently while sending through ionic.io to test i’ve been getting the 301 error (for mismatch of production and development certificates), though i’ve uploaded my production certificates many times.


#20

@Jukov, @dponrals guys, I rad your post about 20 times, I have tried al steps from ionic push docs hundred times, all that I achieved is a dev push which is simple alert in emulator or on a real device.
Pls if some one can help me to include push notifications in my app, I will really appreciate it, I also ready to give you money reward for that help )))) Pls someone.