![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
kinvey-nativescript-sdk
Advanced tools
From the command prompt go to your app's root folder and execute:
npm i kinvey-nativescript-sdk
We need to initialize the SDK before your app starts, so open app.js
and add this before application.start();
:
import * as Kinvey from 'kinvey-nativescript-sdk';
Kinvey.init({
appKey: '<yourAppKey>',
appSecret: '<yourAppSecret>'
});
import * as Kinvey from 'kinvey-nativescript-sdk';
Kinvey.init({
appKey: '<yourAppKey>',
appSecret: '<yourAppSecret>'
});
Import the KinveyModule
in your app.module.ts
like this to initialize the SDK:
import { NgModule } from '@angular/core';
import { KinveyModule } from 'kinvey-nativescript-sdk/angular';
@NgModule({
imports: [
KinveyModule.init({
appKey: '<yourAppKey>',
appSecret: '<yourAppSecret>'
})
]
})
export class AppModule { }
Then you can use dependency injection to inject a Kinvey service in your module like this:
import { Component } from '@angular/core';
import { UserService } from 'kinvey-nativescript-sdk/angular';
@Component()
export class AppComponent {
constructor(private userService: UserService) {}
async login() {
try {
const user = await this.userService.login('<username>', '<password>');
console.log(user);
} catch (error) {
console.log(error);
}
}
}
The following services are available to use with dependency injection:
DataStoreService
EndpointService
FilesService
PingService
UserService
You will need to install nativescript-plugin-firebase
and follow the instructions at https://github.com/EddyVerbruggen/nativescript-plugin-firebase#prerequisites on how to setup your app. Make sure to require the nativescript-plugin-firebase
plugin in your app.ts
file as shown in the example app.
You can then use the Push module to register the device running your app like this:
import * as Push from 'kinvey-nativescript-sdk/push';
function receivedPushNotificaiton(message) {
console.log("Title: " + message.title);
console.log("Body: " + message.body);
// if your server passed a custom property called 'foo', then do this:
console.log("Value of 'foo': " + message.data.foo);
}
Push.register(receivedPushNotification)
.then((deviceToken) => {
console.log(`The device with device token ${deviceToken} is registered for push.`);
})
.catch((error) => {
console.log(error);
})
To unregister the device running your app do this:
import * as Push from 'kinvey-nativescript-sdk/push';
Push.unregister()
.then((deviceToken) => {
console.log(`The device with device token ${deviceToken} has been unregistered for push.`);
})
.catch((error) => {
console.log(error);
})
You will need to import the KinveyPushModule
in your app.module.ts
like this:
import { NgModule } from '@angular/core';
import { KinveyModule } from 'kinvey-nativescript-sdk/angular';
import { KinveyPushModule } from 'kinvey-nativescript-sdk/angular/push';
@NgModule({
imports: [
KinveyModule.init({
appKey: '<yourAppKey>',
appSecret: '<yourAppSecret>'
}),
KinveyPushModule
]
})
export class AppModule { }
Then you can use dependency injection to inject the PushService
in your module like this:
import { Component } from '@angular/core';
import { PushService } from 'kinvey-nativescript-sdk/angular/push';
@Component()
export class AppComponent {
constructor(private pushService: PushService) {}
receivedPushNotificaiton(message) {
console.log("Title: " + message.title);
console.log("Body: " + message.body);
// if your server passed a custom property called 'foo', then do this:
console.log("Value of 'foo': " + message.data.foo);
}
async registerForPush() {
try {
const deviceTokne = await this.pushService.register(this.receivedPushNotification);
console.log(`The device with device token ${deviceToken} has been unregistered for push.`);
} catch (error) {
console.log(error);
}
}
}
If you would like to build the SDK yourself, clone the monorepo, then:
npm i
npm run build
You can then install the SDK build by running npm i /<localpath>/packages/nativescript-sdk
FAQs
Kinvey JavaScript SDK for NativeScript applications.
The npm package kinvey-nativescript-sdk receives a total of 17 weekly downloads. As such, kinvey-nativescript-sdk popularity was classified as not popular.
We found that kinvey-nativescript-sdk demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.