Support Topics Documentation Slack YouTube Blog

Backendless.Messaging.addPushNotificationListener is undefined (not a function)


(Decarlo Williams) #23

I’m also having this issue and when I look at the backendless.d.ts . I don’'t see addPushNotificationListener or removePushNotificationListener

(Vladimir Upirov) #24

hi @Decarlo_Williams
these methods

  • Backendless.Messaging.addPushNotificationListener
  • Backendless.Messaging.removePushNotificationListener

comes from backendless-react-native module, while backendless.d.ts it’s just a types definitions for JS-SDK

Do you use TypeScript in your RN project? if so, please create a separated support topic because it’s another issue

Regards, Vlad

(Decarlo Williams) #25

I can see the console.log results but for some reason it just has an error in my editor.

(Marcio) #26

Hi Guys, in an attempt to register an android device I got a message:

registerDevice: Error: Backendless encountered an error while handling the request. An internal trouble ticket with ID 23C452CD-32B2-BA28-FFB4-D7091CD7C800 has been created and we will be investigating the issue.

Could anyone tell me what’s that about and what should I do next, please? Regards

(Vladimir Upirov) #27

Hi Marcio
What kind of apiKey do you use for Backendless.initApp(APP_ID, API_KEY) ?
I mean JS, Android, iOS, …

(Marcio) #28

Hi @vladimir-upirov , I’m using a JS API key through all the App, since I was working only with API requests I had no problem. I switch once to use iOS or Android keys using the platform selector but gave me permissions issues and in order to work I end up having to allow almost all users in Roles Permissions. Didn’t feel right to me.

Do I have to use the iOS and Android Keys? Regards

(Sergey Chupov) #29

Could you please also provide the exact code sample that you use to register your device?

(Vladimir Upirov) #30

Hi Marcio,
yes looks like that’s the problem,
let me explain how it correctly works: when you register a new device, under hood, backendless-react-native loads list of PushTemplates for platform which is corresponding to API_KEY, it means when use ANDROID_API_KEY you get push templates for Android,
when IOS_API_KEY - ios templates,
JS - JS templates, and here is the issue, because there are no push templates for JS devices and as result you’ve got an InternalServerError (ticket for fix: BKNDLSS-18416)

so, we’re going to change this logic, after fix the problem will disappear, and you will able to use any API_KEY (ticket number for reference: BKNDLSS-18426)

for now as workaround you can use:

const APP_ID = 'YOUR_APP_ID';

const APP_KEY ={
  ios    : 'YOUR_IOS_API_KEY',

Backendless.initApp(APP_ID, APP_KEY);

Regards, Vlad