RocketChat / Rocket.Chat.Cordova

Rocket.Chat Cross-Platform Mobile Application via Cordova (DEPRECATED)
MIT License
104 stars 109 forks source link

Rocket chat cordova app Push Notification issue on android #75

Open nabaragpaul opened 8 years ago

nabaragpaul commented 8 years ago

Hello all, I am using rocket chat cordova for mobile app in android platform. I am not getting any notification in the device . I have created a new project in google developer console , generated sender ID and api key with GCM and using it in index.js file and I have added the same GCM api keys and sender ID in web instance where it was required but no luck yet.

Any kind of help is appreciated .

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

maxlinux2000 commented 7 years ago

please check if there are spaces in the android_sender_id.js and budsnag_apikeys.js.

then logout from any sessions from the computer and mobile, and after 5 minutes, login with mobile and in a channel write "@other-user-account: Hello!!"

in a few seconds should ring the push notification in the other-user mobile

raniel90 commented 7 years ago

@maxlinux2000

Is it mandatory to configure bugsnag_apikeys.js for the push to work? I have checked the blanks of the android_sender_id.js and bugsnag_apikeys.js files and they are correct.

I set up the GCM api key and GCM project number in the Rocket.Chat admin panel and set up the sender id in android_sender_id.js in the cordova app, but in the Rocket.Chat log it did not say if the device was registered.

Another question is that the _raix_push_notifications and _raix_push_app_tokens collections were created, but when executing a query such as:

Db._raix_push_app_tokens.find ({userId: 'MZiFvWAfF4RF4AD5u'});

It is informed that:

001-rs: PRIMARY> db._raix_push_app_tokens.find ();
2016-06-12T21: 44: 01.770 + 0200 E QUERY TypeError: Can not call method 'find' of undefined
At (shell): 1: 26

I am using version 0.56 of Rocket.Chat

geekgonecrazy commented 6 years ago

you'll have to do: db.getCollection('_raix_push_app_tokens').find()

raniel90 commented 6 years ago

@geekgonecrazy I noticed that rocket.chat is not able to allocate token from gcm to userId. When I access with an apple device, the log displays the apn token. In the '_raix_push_app_tokens' collection it also does not show any gcm token information, just apn. Also, I tested my apn data and it worked, but when I try to send a push to my user, the push is not sent.

jampod-dev commented 6 years ago

This was the issue for me:

Uncaught SecurityError: Failed to execute 'toDataURL' on 'HTMLCanvasElement': Tainted canvases may not be exported. in the mobile app.

Which was triggered by adding user avatars to the notifications in packages/rocketchat-ui/client/lib/avatar.js.

Just returning an empty string if the security error was thrown was the quick fix.

AnshD12 commented 6 years ago

hello everyone I tried all the steps mentioned in rocket chat docs for push notification but its still not working its showing and error token for this user does not exists let me tell you I am trying this for personal android project based on rocket chat apis so can anyone tell me

  1. how this token gets generated is there a method or I need to that manually
  2. do I need to add google-services.json to android project
  3. anything else I need to do apart from given steps on docs for push notification for android