Skip to content

Commit 4fe2443

Browse files
author
Alamgir Mand
committed
2 parents 5fd8fa0 + 3adcdec commit 4fe2443

File tree

8 files changed

+370
-8
lines changed

8 files changed

+370
-8
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ before_install:
3030
before_script:
3131
- chmod +x gradlew
3232
script:
33-
- ./gradlew unittest:build
33+
- ./gradlew unittest:testReleaseUnitTest
3434
after_failure:
3535
- cat build/reports/lint-results.xml
3636
- cat build/outputs/lint-results-debug.xml

OneSignalSDK/onesignal/src/main/java/com/onesignal/NotificationExtenderService.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,19 @@
5353
</service>
5454
*/
5555

56+
/**
57+
* OneSignal supports sending additional data along with a notification as key/value pairs.
58+
* You can read this additional data when a notification is opened by adding a
59+
* {@link com.onesignal.OneSignal.NotificationOpenedHandler} instead.
60+
* <br/><br/>
61+
* However, if you want to do one of the following, continue with the instructions
62+
* <a href="https://documentation.onesignal.com/docs/android-native-sdk#section--notificationextenderservice-">here</a>:
63+
* <br/><br/>
64+
* - Receive data in the background with our without displaying a notification
65+
* <br/>
66+
* - Override specific notification settings depending on client-side app logic (e.g. custom accent color,
67+
* vibration pattern, any other {@link NotificationCompat} options)
68+
*/
5669
public abstract class NotificationExtenderService extends IntentService {
5770

5871
public static class OverrideSettings {

OneSignalSDK/onesignal/src/main/java/com/onesignal/OSNotification.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,28 @@
3434
import org.json.JSONException;
3535
import org.json.JSONObject;
3636

37+
/**
38+
* The notification the user received
39+
* <br/><br/>
40+
* {@link #isAppInFocus} - Was app in focus.
41+
* <br/>
42+
* {@link #shown} - Was notification shown to the user. Will be {@code false} for silent notifications.
43+
* <br/>
44+
* {@link #androidNotificationId} - Android Notification ID assigned to the notification. Can be used to cancel or replace the notification
45+
* <br/>
46+
* {@link #payload} - Payload received from OneSignal
47+
* <br/>
48+
* {@link #displayType} - How the notification was displayed ot the user. Can be set to {@link DisplayType#Notification Notification},
49+
* {@link DisplayType#InAppAlert InAppAlert}, or {@link DisplayType#None None} if it was not displayed.
50+
* <br/>
51+
* {@link #groupedNotifications} - If the notification is a summary notification for a group, this will contain
52+
* all notification payloads it was created from.
53+
*/
3754
public class OSNotification {
3855

56+
/**
57+
* How the notification was displayed to the user. Part of {@link OSNotification}.
58+
*/
3959
public enum DisplayType {
4060
// Notification shown in the notification shade.
4161
Notification,

OneSignalSDK/onesignal/src/main/java/com/onesignal/OSNotificationAction.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@
2727

2828
package com.onesignal;
2929

30+
/**
31+
* The action the user took on the notification.
32+
*/
3033
public class OSNotificationAction {
3134
public enum ActionType {
3235
// Notification was tapped on.

OneSignalSDK/onesignal/src/main/java/com/onesignal/OSNotificationOpenResult.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@
3030
import org.json.JSONException;
3131
import org.json.JSONObject;
3232

33+
/**
34+
* The information returned from a notification the user received.
35+
* <br/><br/>
36+
* {@link #notification} - Notification the user received
37+
* <br/>
38+
* {@link #action} - The action the user took on the notification
39+
*/
3340
public class OSNotificationOpenResult {
3441
public OSNotification notification;
3542
public OSNotificationAction action;

OneSignalSDK/onesignal/src/main/java/com/onesignal/OSNotificationPayload.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,13 @@
3434
import java.util.List;
3535

3636
// Notification properties received from OneSignal.
37+
38+
/**
39+
* Contents and settings of the notification received. See
40+
* <a href="https://documentation.onesignal.com/docs/android-native-sdk#section--osnotificationpayload-">
41+
* OSNotificationPayload | OneSignal Docs
42+
* </a> for a list of explanations for each field.
43+
*/
3744
public class OSNotificationPayload {
3845
public String notificationID;
3946
public String title, body;
@@ -87,7 +94,10 @@ public OSNotificationPayload(JSONObject jsonObject) {
8794
priority = jsonObject.optInt("priority");
8895
rawPayload = jsonObject.optString("rawPayload");
8996
}
90-
97+
98+
/**
99+
* List of action buttons on the notification. Part of {@link OSNotificationPayload}.
100+
*/
91101
public static class ActionButton {
92102
public String id;
93103
public String text;
@@ -116,6 +126,9 @@ public JSONObject toJSONObject() {
116126
}
117127
}
118128

129+
/**
130+
* If a background image was set, this object will be available. Part of {@link OSNotificationPayload}.
131+
*/
119132
public static class BackgroundImageLayout {
120133
public String image;
121134
public String titleTextColor;

0 commit comments

Comments
 (0)