This is a migrated thread and some comments may be shown as answers.

Nativescript push-plugin not working with Telerik Platform

4 Answers 104 Views
Push Notifications
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Jonathan Salomon
Top achievements
Rank 1
Jonathan Salomon asked on 30 Jan 2017, 10:32 PM

Hi,

I am trying to use the nativescript-push-plugin with Telerik platform (for now on Android). At the end of my login procedure (includes authenticating the user with Telerik platform) I call the method below.

```
import {Injectable} from '@angular/core';
import {ConfigProvider} from '../providers/config';

var Everlive = require('everlive-sdk');

@Injectable()
export class BackendProvider {

  public telerik:any;
  public devicePushSettings:any;

  constructor (public config: ConfigProvider) {
    this.telerik = new Everlive({
      appId: this.config.telerik.appId,
      scheme: "https"
    });

    this.devicePushSettings = {
      iOS: {
        badge: 'true',
        sound: 'true',
        alert: 'true'
      },
      android: {
        projectNumber: this.config.telerik.googleFirebaseSenderId
      },
      notificationCallbackIOS: ((event) => {
        console.log('receivedPushNotification: '+event.payload.title);
      }),
      notificationCallbackAndroid: ((event) => {
        console.log('receivedPushNotification: '+event.payload.title);
      })
    };
  };

public registerPushDevice() {
    var pushPlugin = require("nativescript-push-notifications");

    /* register pushPlugin with Telerik platform */

    this.telerik.push.register(this.devicePushSettings, () => {
      console.log("Successful registration in Telerik Platform. You are ready to receive push notifications.");
    }, (error) => {
      console.log('Failed to register push device in Telerik Platform');
      console.dump(error);
    });
  }
```

This results in in an error `{ "code": "MODULE_NOT_FOUND" }`. The thing is that AFAIK the pushNotification module is found properly, because if I register with firebase directly it works just fine:

```
public registerPushDevice() {
    var pushPlugin = require("nativescript-push-notifications");

    /* register pushPlugin with Firebase directly */

    pushPlugin.register({ senderID: this.config.telerik.googleFirebaseSenderId }, (data) => {
      console.log("Successful registration in Firebase. You are ready to receive push notifications.");
    }, (error) => {
      console.log('Failed to register push device in Firebase');
      console.dump(error);
    });
}
```

Any idea what might be going on? I already updated the everlive-sdk to the latest v1.9.2 but it didn't help either. I did update the `build.gradle` and `google-services.json` according to the docs (I guess otherwise the Firebase registration would not work). Also I removed and re-added the android platform to rule out any issues with that.

Thanks!

4 Answers, 1 is accepted

Sort by
0
Georgi Prodanov
Telerik team
answered on 31 Jan 2017, 12:09 PM
Hello Jonathan,

This is an issue of compatibility between our SDK and the push plugin. We are aware of it and it will be fixed in the next version of the plugin.

In the meantime, you can use it in the way you have already found to be working. The only thing you need to make sure is that the native app is initialized - meaning that you use the plugin after the NativeScript application launch event has been fired.

In the next version of the plugin, there will be even more integration improvements - you won't need to manually change the build.gradle file, for instance. Its release shouldn't take long so stay tuned.

Regards,
Georgi Prodanov
Telerik by Progress
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
0
Anton
Top achievements
Rank 1
answered on 03 Feb 2017, 03:08 PM
This is fixed in version 0.1.1 of the plugin - https://github.com/NativeScript/push-plugin/releases/tag/0.1.1
0
Kunle
Top achievements
Rank 1
answered on 08 Sep 2017, 11:44 AM
Hi, we are experiencing a similar problem with our app but on IOS (it works fine on android). The device will not register and the plugin throws an error with an "EverliveError":"A plugin error occurred". Any help would be greatly appreciated. We getting the error from our app and from the https://github.com/NativeScript/sample-push-plugin demo app.
0
Anton Dobrev
Telerik team
answered on 12 Sep 2017, 12:16 PM
@Kunle

This error may occur on iOS when the native logic in the plugin cannot initialize push notifications. This is usually connected to the Apple App ID and provisioning profile not enabled for push notifications, not added push notifications entitlement in the native Xcode project, respectively or using a different provisioning profile. 

May I suggest that you consult these two issues in the plugin repository here and here for more information.

Also, can you please share if you are getting the alert that states that this app would like to send you push notifications?

This is usually a client-side configuration issue which should be resolved by checking the above. 

I hope this helps. 

Regards,
Anton Dobrev
Progress Telerik
 
Everlive is now Telerik Backend Services, and is part of the Telerik Platform.
 
Tags
Push Notifications
Asked by
Jonathan Salomon
Top achievements
Rank 1
Answers by
Georgi Prodanov
Telerik team
Anton
Top achievements
Rank 1
Kunle
Top achievements
Rank 1
Anton Dobrev
Telerik team
Share this question
or