{N} Push Notifications using Kinvey


#1

Hi All,

I am in the process of implementing NativeScript Push Notifications with Kinvey. I see there are few articles in Kinvey and supporting documentation in {N} which uses nativescript-push plugin which internally uses kinvey-nativescript-sdk.

https://devcenter.kinvey.com/nativescript/guides/push

However, I see there are couple of issues/problems in this path. Can you please point me to any working sample that I can refer through?

Following are high level steps performed:

  1. Installed a sample NativeScript app (say master-detail app)
  2. Created an app in Kinvey
  3. Created a project in Firebase. Took Server key and Sender Key
  4. Configured those details in Kinvey’s app (under Push settings)
  5. Did some customizations it asked me to do in app.gradle file, etc
  6. In NativeScript app configured the kinvey.init section such that {N} will look through Kinvey’s backend services

At this point when I try to perform tns run android it results in errors and fails to perform gradle build operation.

Please fix the version conflict either by updating the version of the google-services plugin (information about the latest version is
available at https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating the version of com.google.android.gms to 11.4.2.

To resolve this error I modified build.gradle to point to 3.2.0 (latest version) of com.google.gms:google-services and now it results in following error:

org.gradle.api.ProjectConfigurationException: A problem occurred configuring project ‘:app’.
16:16:27.021 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] at org.gradle.configuration.project.LifecycleProjectEvaluator.addConfigurationFailure(LifecycleProjectEvaluator.java:87)

Thanks,
Anil


#2

This looks like a dependency issue. Would you mind sharing the package.json and the app.gradle?


#3

Hi Brian,

Seems I cannot upload the json files here. I am adding complete contents of both package.json and app.gradle file(s)

package.json contents

{
“description”: “NativeScript Application”,
“license”: “SEE LICENSE IN “,
“readme”: “NativeScript Application”,
“repository”: “”,
“nativescript”: {
“id”: “org.nativescript.masterDetail”,
“tns-android”: {
“version”: “3.4.1”
}
},
“scripts”: {
“lint”: “tslint “app/**/*.ts””
},
“dependencies”: {
@angular/animations”: “~5.2.0”,
"@angular/common": “~5.2.0”,
"@angular/compiler": “~5.2.0”,
"@angular/core": “~5.2.0”,
"@angular/forms": “~5.2.0”,
"@angular/http": “~5.2.0”,
"@angular/platform-browser": “~5.2.0”,
"@angular/platform-browser-dynamic": “~5.2.0”,
"@angular/router": “~5.2.0”,
“kinvey-nativescript-sdk”: “^3.9.10”,
“nativescript-angular”: “~5.2.0”,
“nativescript-imagepicker”: “~4.0.1”,
“nativescript-plugin-firebase”: “~5.0.5”,
“nativescript-pro-ui”: “~3.3.0”,
“nativescript-push-notifications”: “^1.1.0”,
“nativescript-theme-core”: “~1.0.4”,
“reflect-metadata”: “~0.1.10”,
“rxjs”: “~5.5.5”,
“tns-core-modules”: “~3.4.0”,
“zone.js”: “~0.8.18”
},
“devDependencies”: {
"@angular/compiler-cli": “~5.2.0”,
"@ngtools/webpack": “~1.9.4”,
“babel-traverse”: “6.4.5”,
“babel-types”: “6.4.5”,
“babylon”: “6.4.5”,
“codelyzer”: “~4.0.2”,
“copy-webpack-plugin”: “~4.3.0”,
“css-loader”: “~0.28.7”,
“extract-text-webpack-plugin”: “~3.0.2”,
“lazy”: “1.0.11”,
“nativescript-dev-sass”: “~1.3.5”,
“nativescript-dev-typescript”: “~0.6.0”,
“nativescript-dev-webpack”: “~0.9.1”,
“nativescript-worker-loader”: “~0.8.1”,
“raw-loader”: “~0.5.1”,
“resolve-url-loader”: “~2.2.1”,
“sass-loader”: “~6.0.6”,
“tslint”: “~5.8.0”,
“typescript”: “~2.6.2”,
“uglifyjs-webpack-plugin”: “~1.1.6”,
“webpack”: “^3.11.0”,
“webpack-bundle-analyzer”: “^2.10.1”,
“webpack-sources”: “~1.1.0”
}
}

app.gradle contents:

// Add your native dependencies here:

// Uncomment to add recyclerview-v7 dependency
//dependencies {
// compile ‘com.android.support:recyclerview-v7:+’
//}

android {
defaultConfig {
generatedDensities = []
applicationId = “org.nativescript.masterDetail”
}
aaptOptions {
additionalParameters “–no-version-vectors”
}

// project.ext {
// firebaseMessagingVersion = “11.0.4”
// }

project.ext {
googlePlayServicesVersion = “11.2.+”
}
}
[/details]

Thanks,
Anil


#4

@venkat_1241 Apologies for taking so long to pick up on this.

I have followed your steps to the letter, but I cannot reproduce your build errors. My project just builds fine (also based on Kinvey master/detail)
Could you remove this:

project.ext {
googlePlayServicesVersion = “11.2.+”
}

from your gradle file? Also could you check if you have Google Play Services installed on your dev machine (e.g. using Android’s SDK Manager) and what version it’s on?

It might be worthwhile to do a direct debugging session, if you like.

I’m on UTC+1 and you can reach me on julian.steiner@progress.com
Once we find a resolution I’ll update this thread for future reference.