Skip to content

Instantly share code, notes, and snippets.

@mrcnkoba
Created September 27, 2017 09:36
Show Gist options
  • Save mrcnkoba/be2326e65e496213345853e8eaf9c890 to your computer and use it in GitHub Desktop.
Save mrcnkoba/be2326e65e496213345853e8eaf9c890 to your computer and use it in GitHub Desktop.
TalkJS makes it simple to send iOS/Android Mobile Push Notifications. The moment you are set up and your users use TalkJS inside your Mobile app, TalkJS will send them notifications on every message, so that they don't miss anything. Here is what you need to get started:
1.
a. Copy the server key from Firebase dashboard and paste into the TalkJS dashboard.
b. Generate a production .p12 certificate for iOS push notifications in the Apple Developer Dashboard and upload it into the TalkJS dashboard.
2. Add your users' device tokens using TalkJS Javascript SDK.
Here is a short code example presenting how to add a device token using Cordova/Phone-gap push plugin:
```
var session = new Talk.Session({
appId: "Hku1c4Pt",
publishableKey: "984769823478928374",
me: me
});
const pushObject: PushObject = this.push.init({
...
});
pushObject.on('registration').subscribe((registration: any) => {
var platform = "android"; // "android" | "ios"
this._session.registerDevice({platform: platform, pushRegistrationId: registration.registrationId});
});
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment