Skip to content
This repository was archived by the owner on Feb 7, 2019. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/issue_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
### Make sure to check the demo app(s) for sample usage

### Make sure to check the existing issues in this repository

### If the demo apps cannot help and there is no issue for your problem, tell us about it
Please, ensure your title is less than 63 characters long and starts with a capital
letter.

### Which platform(s) does your issue occur on?
- iOS/Android/Both
- iOS/Android versions
- emulator or device. What type of device?

### Please, provide the following version numbers that your issue occurs with:

- CLI: (run `tns --version` to fetch it)
- Cross-platform modules: (check the 'version' attribute in the
`node_modules/tns-core-modules/package.json` file in your project)
- Runtime(s): (look for the `"tns-android"` and `"tns-ios"` properties in the `package.json` file of your project)
- Plugin(s): (look for the version numbers in the `package.json` file of your
project and paste your dependencies and devDependencies here)

### Please, tell us how to recreate the issue in as much detail as possible.
Describe the steps to reproduce it.

### Is there any code involved?
- provide a code example to recreate the problem
- (EVEN BETTER) provide a .zip with application or refer to a repository with application where the problem is reproducible.
35 changes: 16 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,21 @@ In case the application doesn't work as expected. Here are some things you can v

- When the application is started using `tns run android` (i.e. in debug mode with livesync) some background notifications might not be received correctly. This happens because the app is not started in a normal way for debugging and the resume from background happens differently. To receive all notifications correctly, stop the app (swipe it away it from the recent apps list) and start it again by tapping the app icon on the device.

- Thе `google-services` plugin is added automatically. If this fails, you can try adding it manually:
- - Navigate to the project `platforms/android/` folder and locate the application-level `build.gradle` file
- - Add the `google-services` plugin to the list of other dependencies in your app's `build.gradle` file
```Groovy
dependencies {
// ...
classpath "com.google.gms:google-services:3.0.0"
// ...
}
```
- - Add the following line be at the bottom of your `build.gradle` file to enable the Gradle plugin
```Groovy
apply plugin: 'com.google.gms.google-services'
```

- Ensure that the AndroidManifest.xml located at platforms/android/build/... (**do not add it in your "App_Resources/Android/AndroidManifest.xml" file**) contains the following snippets for registering the GCM listener:
```XML
<activity android:name="com.telerik.pushplugin.PushHandlerActivity"/>
Expand Down Expand Up @@ -451,31 +466,13 @@ In case the application doesn't work as expected. Here are some things you can v

The `nativescript-push-notifications` module for Android relies on the Firebase Cloud Messaging (FCM) SDK. In the steps below you will be guided to complete a few additional steps to prepare your Android app to receive push notifications from FCM.

1. Add the FCM SDK

> Thе `google-services` plugin is added automatically. If this fails, you can try adding it manually:

- Navigate to the project `platforms/android/` folder and locate the application-level `build.gradle` file
- Add the `google-services` plugin to the list of other dependencies in your app's `build.gradle` file
```Groovy
dependencies {
// ...
classpath "com.google.gms:google-services:3.0.0"
// ...
}
```
- Add the following line be at the bottom of your `build.gradle` file to enable the Gradle plugin
```Groovy
apply plugin: 'com.google.gms.google-services'
```

1. Add the `google-services.json` file

To use FCM, you need this file. It contains configurations and credentials for your Firebase project. To obtain this follow the instructions for adding Firebase to your project from the official [documentation](https://firebase.google.com/docs/android/setup). Scroll down to the **Manually add Firebase** section.

Place the file in your app's `App_Resources/Android` folder

1. Obtain the FCM Server Key (optional)
2. Obtain the FCM Server Key (optional)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you want to keep consistent with the rest of the file, ordered lists should be 1 1 1 and not 1 2 3


This key is required to be able to send programmatically push notifications to your app. You can obtain this key from your Firebase project.

Expand Down
5 changes: 4 additions & 1 deletion demo/app/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,23 @@ app.on(app.resumeEvent, function(args) {
const act = args.android;
const intent = act.getIntent();
const extras = intent.getExtras();
console.log("Resuming activity");
if (extras) {
console.log("If your notification has data (key: value) pairs, they will be listed here:");
const keys = extras.keySet();
const iterator = keys.iterator();
while (iterator.hasNext()) {
const key = iterator.next();
console.log(key + ": " + extras.get(key).toString());
// clear the used keys in order to avoid getting them back
// when manually switching the application between background and foreground
intent.removeExtra(key);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure if all extras are set by the FCM SDK

}
}
}
});

app.start({ moduleName: 'main-page' });

/*
Do not place any code after the application has been started as it will not
be executed on iOS.
Expand Down