Skip to content

Commit 615309f

Browse files
committed
Added badge support and fixed NotificationOpened disable bug with urls
1 parent 922f85b commit 615309f

File tree

70 files changed

+1078
-213
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

70 files changed

+1078
-213
lines changed

OneSignalSDK/.idea/.name

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OneSignalSDK/.idea/modules.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

OneSignalSDK/OneSignalExampleDev.iml

Lines changed: 0 additions & 19 deletions
This file was deleted.

OneSignalSDK/app/app.iml

Lines changed: 28 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="OneSignalExampleDev" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
2+
<module external.linked.project.id=":app" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$/.." external.system.id="GRADLE" external.system.module.group="OneSignalSDK" external.system.module.version="unspecified" type="JAVA_MODULE" version="4">
33
<component name="FacetManager">
44
<facet type="android-gradle" name="Android-Gradle">
55
<configuration>
@@ -70,60 +70,58 @@
7070
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/blame" />
7171
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/classes" />
7272
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/dependency-cache" />
73-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/22.0.0/jars" />
74-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/22.0.0/jars" />
75-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-analytics/7.0.0/jars" />
76-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/7.0.0/jars" />
77-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-gcm/7.0.0/jars" />
78-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-location/7.0.0/jars" />
79-
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-maps/7.0.0/jars" />
73+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/appcompat-v7/23.1.1/jars" />
74+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.android.support/support-v4/23.1.1/jars" />
75+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-base/8.4.0/jars" />
76+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-basement/8.4.0/jars" />
77+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-gcm/8.4.0/jars" />
78+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-location/8.4.0/jars" />
79+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-maps/8.4.0/jars" />
80+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/exploded-aar/com.google.android.gms/play-services-measurement/8.4.0/jars" />
8081
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/incremental" />
8182
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/jniLibs" />
8283
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/manifests" />
8384
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/pre-dexed" />
85+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/proguard-rules" />
8486
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/res" />
8587
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/rs" />
88+
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/sourceFolderJavaResources" />
8689
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/symbols" />
8790
<excludeFolder url="file://$MODULE_DIR$/build/intermediates/transforms" />
8891
<excludeFolder url="file://$MODULE_DIR$/build/outputs" />
8992
<excludeFolder url="file://$MODULE_DIR$/build/tmp" />
9093
</content>
9194
<orderEntry type="jdk" jdkName="Android API 23 Platform" jdkType="Android SDK" />
9295
<orderEntry type="sourceFolder" forTests="false" />
93-
<orderEntry type="library" exported="" name="play-services-base-7.0.0" level="project" />
96+
<orderEntry type="library" exported="" name="play-services-base-8.4.0" level="project" />
9497
<orderEntry type="library" exported="" scope="TEST" name="asm-5.0.1" level="project" />
95-
<orderEntry type="library" exported="" name="play-services-location-7.0.0" level="project" />
96-
<orderEntry type="library" exported="" scope="TEST" name="shadows-core-3.1-SNAPSHOT" level="project" />
97-
<orderEntry type="library" exported="" scope="TEST" name="robolectric-annotations-3.1-SNAPSHOT" level="project" />
98-
<orderEntry type="library" exported="" scope="TEST" name="robolectric-utils-3.1-SNAPSHOT" level="project" />
99-
<orderEntry type="library" exported="" scope="TEST" name="xpp3_min-1.1.4c" level="project" />
100-
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-library-1.3" level="project" />
101-
<orderEntry type="library" exported="" scope="TEST" name="protobuf-java-2.6.1" level="project" />
98+
<orderEntry type="library" exported="" scope="TEST" name="robolectric-utils-3.0" level="project" />
10299
<orderEntry type="library" exported="" scope="TEST" name="ant-1.8.0" level="project" />
103-
<orderEntry type="library" exported="" name="support-annotations-22.0.0" level="project" />
104-
<orderEntry type="library" exported="" name="play-services-gcm-7.0.0" level="project" />
105-
<orderEntry type="library" exported="" scope="TEST" name="robolectric-3.1-SNAPSHOT" level="project" />
106-
<orderEntry type="library" exported="" scope="TEST" name="accessibility-test-framework-2.1" level="project" />
100+
<orderEntry type="library" exported="" name="appcompat-v7-23.1.1" level="project" />
101+
<orderEntry type="library" exported="" scope="TEST" name="accessibility-test-framework-1.0" level="project" />
107102
<orderEntry type="library" exported="" scope="TEST" name="bcprov-jdk16-1.46" level="project" />
103+
<orderEntry type="library" exported="" name="play-services-location-8.4.0" level="project" />
108104
<orderEntry type="library" exported="" scope="TEST" name="sqlite4java-0.282" level="project" />
109105
<orderEntry type="library" exported="" scope="TEST" name="maven-ant-tasks-2.1.3" level="project" />
110-
<orderEntry type="library" exported="" scope="TEST" name="xmlpull-1.1.3.1" level="project" />
111-
<orderEntry type="library" exported="" name="play-services-maps-7.0.0" level="project" />
112-
<orderEntry type="library" exported="" name="support-v4-22.0.0" level="project" />
113-
<orderEntry type="library" exported="" scope="TEST" name="robolectric-resources-3.1-SNAPSHOT" level="project" />
114-
<orderEntry type="library" exported="" scope="TEST" name="vtd-xml-2.11" level="project" />
106+
<orderEntry type="library" exported="" scope="TEST" name="robolectric-resources-3.0" level="project" />
107+
<orderEntry type="library" exported="" scope="TEST" name="robolectric-annotations-3.0" level="project" />
108+
<orderEntry type="library" exported="" name="support-annotations-23.1.1" level="project" />
109+
<orderEntry type="library" exported="" scope="TEST" name="shadows-core-3.0" level="project" />
110+
<orderEntry type="library" exported="" name="play-services-basement-8.4.0" level="project" />
111+
<orderEntry type="library" exported="" name="play-services-maps-8.4.0" level="project" />
115112
<orderEntry type="library" exported="" scope="TEST" name="asm-commons-5.0.1" level="project" />
116-
<orderEntry type="library" exported="" name="appcompat-v7-22.0.0" level="project" />
113+
<orderEntry type="library" exported="" scope="TEST" name="vtd-xml-2.11" level="project" />
117114
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
118115
<orderEntry type="library" exported="" scope="TEST" name="asm-tree-5.0.1" level="project" />
116+
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
119117
<orderEntry type="library" exported="" scope="TEST" name="asm-analysis-5.0.1" level="project" />
120-
<orderEntry type="library" exported="" name="play-services-analytics-7.0.0" level="project" />
121-
<orderEntry type="library" exported="" scope="TEST" name="xstream-1.4.8" level="project" />
122118
<orderEntry type="library" exported="" scope="TEST" name="icu4j-53.1" level="project" />
119+
<orderEntry type="library" exported="" name="support-v4-23.1.1" level="project" />
123120
<orderEntry type="library" exported="" scope="TEST" name="ant-launcher-1.8.0" level="project" />
124-
<orderEntry type="library" exported="" scope="TEST" name="junit-4.8.2" level="project" />
121+
<orderEntry type="library" exported="" name="play-services-gcm-8.4.0" level="project" />
122+
<orderEntry type="library" exported="" scope="TEST" name="robolectric-3.0" level="project" />
125123
<orderEntry type="library" exported="" scope="TEST" name="asm-util-5.0.1" level="project" />
126-
<orderEntry type="library" exported="" scope="TEST" name="guava-19.0-rc2" level="project" />
124+
<orderEntry type="library" exported="" name="play-services-measurement-8.4.0" level="project" />
127125
<orderEntry type="module" module-name="onesignal" exported="" />
128126
</component>
129127
</module>

OneSignalSDK/app/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ android {
1010
// onesignal_app_id: "5eb5a37e-b458-11e3-ac11-000c2940e62c",
1111
onesignal_app_id: "b2f7f966-d8cc-11e4-bed1-df8f05be55ba",
1212
onesignal_google_project_number: "703322744261"]
13-
minSdkVersion 10
13+
minSdkVersion 9
1414
targetSdkVersion 23
1515
versionCode 1
1616
versionName "1.0"
@@ -19,7 +19,7 @@ android {
1919
debug {
2020
// Test with proguard enabled to make sure our consumer rules are correct in the SDK.
2121
// minify does not work with GMS 7.0.0 with the current settings. Use 8.4.0 to test.
22-
minifyEnabled true
22+
minifyEnabled false
2323
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
2424
}
2525
}

OneSignalSDK/app/src/main/java/com/onesignal/example/BlankActivity.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Modified MIT License
33
*
4-
* Copyright 2015 OneSignal
4+
* Copyright 2016 OneSignal
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -36,6 +36,12 @@ public class BlankActivity extends Activity {
3636
@Override
3737
protected void onCreate(Bundle savedInstanceState) {
3838
super.onCreate(savedInstanceState);
39+
40+
// if (getIntent() != null && (getIntent().getFlags() & Intent.FLAG_ACTIVITY_REORDER_TO_FRONT) != 0) {
41+
// finish();
42+
// return;
43+
// }
44+
3945
System.out.println("BlankActivity onCreate!!!!");
4046

4147
Intent intent = new Intent(this, MainActivity.class);

OneSignalSDK/app/src/main/java/com/onesignal/example/MainActivity.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Modified MIT License
33
*
4-
* Copyright 2015 OneSignal
4+
* Copyright 2016 OneSignal
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -57,6 +57,12 @@ protected void onCreate(Bundle savedInstanceState) {
5757

5858
currentActivity = this;
5959

60+
// OneSignal.setLogLevel(OneSignal.LOG_LEVEL.DEBUG, OneSignal.LOG_LEVEL.NONE);
61+
// OneSignal.startInit(this)
62+
// .setAutoPromptLocation(true)
63+
// .setNotificationOpenedHandler(new ExampleNotificationOpenedHandler())
64+
// .init();
65+
6066
OneSignal.enableInAppAlertNotification(true);
6167
OneSignal.enableNotificationsWhenActive(false);
6268
OneSignal.sendTag("test3", "test3");
@@ -148,8 +154,9 @@ private class ExampleNotificationOpenedHandler implements NotificationOpenedHand
148154
*/
149155
@Override
150156
public void notificationOpened(String message, JSONObject additionalData, boolean isActive) {
151-
Log.i("OneSignalExample", "message: " + message);
152-
Log.i("OneSignalExample", "additionalData: " + additionalData.toString());
157+
Log.e("OneSignalExample", "message: " + message);
158+
Log.e("OneSignalExample", "additional data: " + additionalData);
159+
//Log.e("OneSignalExample", "additionalData: " + additionalData.toString());
153160
}
154161
}
155162
}

OneSignalSDK/app/src/main/java/com/onesignal/example/OneSignalBackgroundDataReceiver.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Modified MIT License
33
*
4-
* Copyright 2015 OneSignal
4+
* Copyright 2016 OneSignal
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal

OneSignalSDK/app/src/main/java/com/onesignal/example/OneSignalExampleApp.java

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,12 @@
22

33
import android.app.Application;
44
import android.os.StrictMode;
5+
import android.util.Log;
56

67
import com.onesignal.OneSignal;
78

9+
import org.json.JSONObject;
10+
811
public class OneSignalExampleApp extends Application {
912

1013
@Override
@@ -14,10 +17,28 @@ public void onCreate() {
1417
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder().detectAll().build());
1518
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().build());
1619

17-
OneSignal.setLogLevel(OneSignal.LOG_LEVEL.DEBUG, OneSignal.LOG_LEVEL.NONE);
20+
OneSignal.setLogLevel(OneSignal.LOG_LEVEL.VERBOSE, OneSignal.LOG_LEVEL.NONE);
1821
OneSignal.startInit(this)
1922
.setAutoPromptLocation(true)
20-
// .setNotificationOpenedHandler(new ExampleNotificationOpenedHandler())
23+
.setNotificationOpenedHandler(new ExampleNotificationOpenedHandler())
2124
.init();
2225
}
23-
}
26+
27+
private class ExampleNotificationOpenedHandler implements OneSignal.NotificationOpenedHandler {
28+
/**
29+
* Callback to implement in your app to handle when a notification is opened from the Android status bar or
30+
* a new one comes in while the app is running.
31+
* This method is located in this activity as an example, you may have any class you wish implement NotificationOpenedHandler and define this method.
32+
*
33+
* @param message The message string the user seen/should see in the Android status bar.
34+
* @param additionalData The additionalData key value pair section you entered in on onesignal.com.
35+
* @param isActive Was the app in the foreground when the notification was received.
36+
*/
37+
@Override
38+
public void notificationOpened(String message, JSONObject additionalData, boolean isActive) {
39+
Log.e("OneSignalExample", "message: " + message);
40+
Log.e("OneSignalExample", "additional data: " + additionalData);
41+
//Log.e("OneSignalExample", "additionalData: " + additionalData.toString());
42+
}
43+
}
44+
}

OneSignalSDK/app/src/main/java/com/onesignal/example/TestNotificationOpenedReceiver.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Modified MIT License
33
*
4-
* Copyright 2015 OneSignal
4+
* Copyright 2016 OneSignal
55
*
66
* Permission is hereby granted, free of charge, to any person obtaining a copy
77
* of this software and associated documentation files (the "Software"), to deal
@@ -33,9 +33,6 @@
3333
import android.os.Bundle;
3434
import android.util.Log;
3535

36-
/**
37-
* Created by Josh on 5/18/2015.
38-
*/
3936
public class TestNotificationOpenedReceiver extends BroadcastReceiver {
4037

4138
// You may consider adding a wake lock here if you need to make sure the devices doesn't go to sleep while processing.

0 commit comments

Comments
 (0)