Meteor-Community-Packages / raix-push

DEPRECATED: Push notifications for cordova (ios, android) browser (Chrome, Safari, Firefox)
https://atmospherejs.com/raix/push
MIT License
513 stars 197 forks source link

Unable to send push for Android with Meteor 1.3.2.4 #214

Closed chrisco23 closed 5 years ago

chrisco23 commented 8 years ago

Hi,

Sorry I left this as a comment on Issue #153 but this morning it occurs to me that in light of the different error situation, I should probably have created a separate issue. So I'm doing that here. Here was my comment:

Glad I found this thread as it seems to get me closer.

After running 'meteor add cordova:cordova-plugin-device@1.1.1', I get

I20160511-00:28:02.938(-7) (android:http://localhost:12488/706a87c28afe2f2833e09f1faae76451d1e9bdb6.js:179) Push.Token: I20160511-00:28:02.943(-7) (android:http://localhost:12488/706a87c28afe2f2833e09f1faae76451d1e9bdb6.js:223) Token: {"gcm":"APA91bECNHQBuGl1W0DdANTBcX3bafsxwABndUhKCl3KZGT0xWpoLOjL95GjdgkUGxPR-k9J7kFdncH3V7InSaIEOB6X6BQrJrQssM8ev5jTn7nSqidjazVMxJqvZfm033PaWO8b0LEl"} I20160511-00:28:02.944(-7) (android:http://localhost:12488/706a87c28afe2f2833e09f1faae76451d1e9bdb6.js:179) Got token: I20160511-00:28:16.770(-7) (android:http://localhost:12488/706a87c28afe2f2833e09f1faae76451d1e9bdb6.js:223) sending notification I20160511-00:28:18.696(-7) (android:http://localhost:12488/706a87c28afe2f2833e09f1faae76451d1e9bdb6.js:179) Push.Notification: I20160511-00:28:18.697(-7) (android:http://localhost:12488/706a87c28afe2f2833e09f1faae76451d1e9bdb6.js:179) Push.Message: Got message while app is open:

Now, I am still using some Meteor.startup() code from when I first successfully used raix:push, last July(!). I have this code from back then still:

`Meteor.startup(function () { console.log('inside notifications.js'); Push.allow({ send: function(userId, notification) { // Allow all users to send to everybody - For test only! return true; } });

Push.debug = true;

/* do something with push token*/ Push.addListener('token', function(token) { console.log('Token: ' + JSON.stringify(token)); });

Push.addListener('notification', function(notification) { console.log('notification: ' + JSON.stringify(notification)) });

Push.addListener('startup', function(notification) { console.log('Routing Push: ' + JSON.stringify(notification)); Router.go('warbleShow', {_id: notification.payload.warbleId}); }); }); `

In light of the messages I mentioned in that first bit of output, I tried closing the application and sending the test notification from localhost:3000 (is that even supposed to work??), and I got:

I20160511-00:30:40.853(-7)? Push: Send message "Hello" via query {} I20160511-00:30:40.855(-7)? Push: Sent message "Hello" to 0 ios apps 0 android apps I20160511-00:30:40.857(-7)? Push, GUIDE: The "Push.appCollection" is empty - No clients have registred on the server yet...

chrisco23 commented 8 years ago

In case this is helpful, I found this in Google Play's GCM Diagnostics:

MESSAGE 0:1462988289872828%F1CA786B0034AF1A

Current Status Acknowledged Collapse Key push TTL 2,419,200 TIME CURRENT STATUS May 10, 11:57 PM Device connected May 11, 10:38 AM Accepted May 11, 10:38 AM Delivered May 11, 11:04 AM Acknowledged

.. that was for my most recent token.. the previous page shows:

May 11, 10:38 AM 0:1462988289872828%f1ca786b0034af1a push 2,419,200 Acknowledged May 11, 10:29 AM 0:1462987749916129%f1ca786b0034af1a push n/a Acknowledged May 11, 10:23 AM 0:1462987389723346%f1ca786b0034af1a push n/a Collapsed May 11, 10:22 AM 0:1462987344907114%f1ca786b0034af1a push n/a Collapsed May 11, 12:28 AM 0:1462951698354190%f1ca786b0034af1a push n/a Acknowledged

indesignlatam commented 8 years ago

Im having a similar issue where android devices wont register a token but ios devices do register their tokens.

Im using Meteor 1.3 and config.configure method on client and server.

etyp commented 8 years ago

Having the same issue here

MaxShv commented 8 years ago

+1

I20160630-11:29:50.679(-4)? Push: Sent message "test" to 0 ios apps 1 android apps I20160630-11:29:50.784(-4)? Unauthorized I20160630-11:29:50.787(-4)? ANDROID: Result of sender is null

mvgalle commented 8 years ago

Same issue here. Devices not registering.

crazybaud commented 8 years ago

Same issue on our side, and it was due to bad GCM server key, gcm.apiKeyin our config.push.json. We changed it here : https://console.cloud.google.com/apis/credentials

jensljungblad commented 8 years ago

I'm getting the same thing on Meteor 1.3.4.4:

I20160630-11:29:50.679(-4)? Push: Sent message "test" to 0 ios apps 1 android apps I20160630-11:29:50.784(-4)? Unauthorized I20160630-11:29:50.787(-4)? ANDROID: Result of sender is null

@MaxShv did you find a workaround?

@crazybaud I tried regenerating the api key a bunch of times but no luck.. What version of Meteor are you on and how have you configured push?

crazybaud commented 8 years ago

Our install :

Client side :

// Configure our notification
Push.Configure({
    "gcm": {
        "projectNumber": "[12 digits]"
    },
    "bagde": true,
    "sound": true,
    "alert": true,
    "vibrate": true
});

Server side :

// Configure our notification
Push.debug = true;
Push.Configure({
  "apn": {
    "passphrase": "[yours]",
    "keyData": Assets.getText('apnDevKey.pem'),
    "certData": Assets.getText('apnDevCert.pem')
  },
  "gcm": {
    "apiKey": "[yours]",
    "projectNumber": "[same digits]"
  },
  "production": true
});

mobile-config.js :

App.configurePlugin('phonegap-plugin-push', {
    SENDER_ID: '[same digits]'
});

hope it helps :)

sschuchlenz commented 8 years ago

Same here and no solution posted in the different issues seems to help. Currently we are using the rc.5 branch with config similar to the one @crazybaud mentioned (only differences are that in one of the other issues it was stated that the project number has to be integer so we tried with and without quotes and we left out APN config due to the fact that we do not support iOS yet) and we've already tried to change the API key in Google's console.

We've also tried with installing cordova-plugin-device@1.1.1 and different other approaches but to no avail.

Edit: Forgot to mention that we use the latest stable meteor release (1.4.x)

raix commented 8 years ago

I have to give 1.4.x a go - haven't had the time to follow their development as closely as I used to - I've cleaned up branches and bumped version to 3.0.3-rc.7 - the device undefined issue was solved a while ago.

Mind I still need to do QA on 3.0.3-rc.7 making sure things work - it's time consuming because I literally have to create an app for both ios and android + test cases

sschuchlenz commented 8 years ago

@raix thanks for looking into it - we've decided to stick with OneSignal and cordova plugin integration for now but once yours is ready for 1.4, we'll give it a test drive

cunneen commented 8 years ago

EDIT: Forget that, i just realised you're talking about an android issue.

Previously: @chrisco23 See my comment on #240 regarding making sure push notification entitlements are enabled.

crazybaud commented 8 years ago

@jensljungblad we upgraded to 1.4.2-beta4 and it is not working anymore on Android (Intercom notification system is functional).

Logs :

[domain.com] Push: Settings userId "3W8m8XqiRSXSR2vNb" for app: TZBmeBs6X4Mekyu3q
[domain.com] Push: Send message "world" via query { userId: '3W8m8XqiRSXSR2vNb' }
[domain.com] Push: Sent message "world" to 0 ios apps 0 android apps

(...)

mongo> db.getCollection("_raix_push_app_tokens").find({"userId":"3W8m8XqiRSXSR2vNb"})
mongo>
jensljungblad commented 8 years ago

@raix I still can't get Android to work on Meteor 1.3.4.4 even with 3.0.3-rc.7. Is it supposed to?

My config:

// Client
Push.Configure({
  android: {
    senderID: '12345',
    badge: true,
    sound: true,
    alert: true,
    vibrate: true
  }
});

// Server
Push.Configure({
  gcm: {
    apiKey: 'abcde'
  }
});

// mobile-config.js
App.configurePlugin('phonegap-plugin-push', {
  SENDER_ID: '12345'
});

After which I get the following error when pushing a message:

Push: Sent message "Foobar" to 0 ios apps 1 android apps
Unauthorized
ANDROID: Result of sender is null
cunneen commented 8 years ago

@jensljungblad check that your IP address has been added to your Google console. Also try using the latest devel branch of raix:push (which I published as appworkshop:push@3.0.3-rc.8 just to make it easier):

meteor remove raix:push
meteor add appworkshop:push@3.0.3-rc.8

Note that I won't be maintaining that version, you should switch back to raix:push as soon as the next version is published.

aqib1604 commented 8 years ago

@jensljungblad @raix I have same issue with android Did you found any workaround?

Push: Sent message "Foobar" to 0 ios apps 1 android apps
Unauthorized
ANDROID: Result of sender is null
cunneen commented 8 years ago

@aqib1604 did you see my message above yours?

aqib1604 commented 8 years ago

@cunneen

When I run by adding your package I am getting following error.

Create GCM Sender using "{GCM Key}"
I20160930-17:48:37.813(5.5)? A:Send message to: eCQtIsmjWWw:APA91bHCdcjFIWlSSKQ4GiLjWDjs7WjWufVKobJjknQfoYmW7w4O-iJ37F8KhER9AsMAnlJqWeWMRW_nvPiZT6jjjc-7QivykoDu3BCMWSJX7DoI2vOzEhE1iiI0vK0QQFDdAU-FkTvL
I20160930-17:48:37.823(5.5)? Push: Sent message "TEST" to 0 ios apps 1 android apps
I20160930-17:48:37.842(5.5)? Push, GUIDE: The "Push.appCollection" - No APN clients have registred on the server yet...
I20160930-17:48:38.036(5.5)? ANDROID ERROR: result of sender: undefined
aqib1604 commented 8 years ago

@cunneen @jensljungblad I have made it working through meteor add appworkshop:push@3.0.3-rc.8 and https://github.com/raix/push/blob/master/docs/ANDROID.md.

Thanks for the help @cunneen

jensljungblad commented 7 years ago

Got it working by following the updated Android instructions and switching to FCM. Thanks!