Skip to content

Commit 9013cbe

Browse files
committed
Bug title, debugging, and logcat fixes
* Fixed issue where title was not settable in the last version. * Fixed rare bug where device would not register as unsubscribed when only part of Google play services we included making the issue harder to debug. * Removed logcat extra warnings from looperj that can be safely ignored, fixed error from showing in the logcat when your app is reinstalled.
1 parent 529d9fe commit 9013cbe

File tree

48 files changed

+697
-60
lines changed

Some content is hidden

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

48 files changed

+697
-60
lines changed

OneSignalSDK.jar

89 Bytes
Binary file not shown.

OneSignalSDK/app/app.iml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,31 +90,30 @@
9090
</content>
9191
<orderEntry type="jdk" jdkName="Android API 22 Platform" jdkType="Android SDK" />
9292
<orderEntry type="sourceFolder" forTests="false" />
93-
<orderEntry type="library" exported="" scope="TEST" name="robolectric-resources-3.0-rc3" level="project" />
93+
<orderEntry type="library" exported="" scope="TEST" name="shadows-core-3.0" level="project" />
9494
<orderEntry type="library" exported="" scope="TEST" name="asm-5.0.1" level="project" />
95+
<orderEntry type="library" exported="" scope="TEST" name="robolectric-utils-3.0" level="project" />
9596
<orderEntry type="library" exported="" scope="TEST" name="asm-commons-5.0.1" level="project" />
9697
<orderEntry type="library" exported="" scope="TEST" name="vtd-xml-2.11" level="project" />
9798
<orderEntry type="library" exported="" scope="TEST" name="hamcrest-core-1.3" level="project" />
9899
<orderEntry type="library" exported="" name="support-annotations-22.1.1" level="project" />
99100
<orderEntry type="library" exported="" scope="TEST" name="asm-tree-5.0.1" level="project" />
100-
<orderEntry type="library" exported="" scope="TEST" name="robolectric-annotations-3.0-rc3" level="project" />
101101
<orderEntry type="library" exported="" scope="TEST" name="asm-analysis-5.0.1" level="project" />
102102
<orderEntry type="library" exported="" scope="TEST" name="junit-4.12" level="project" />
103103
<orderEntry type="library" exported="" name="appcompat-v7-22.1.1" level="project" />
104-
<orderEntry type="library" exported="" scope="TEST" name="robolectric-utils-3.0-rc3" level="project" />
105104
<orderEntry type="library" exported="" scope="TEST" name="icu4j-53.1" level="project" />
106105
<orderEntry type="library" exported="" scope="TEST" name="ant-1.8.0" level="project" />
107-
<orderEntry type="library" exported="" scope="TEST" name="robolectric-3.0-rc3" level="project" />
108-
<orderEntry type="library" exported="" scope="TEST" name="ant-launcher-1.8.0" level="project" />
109106
<orderEntry type="library" exported="" scope="TEST" name="accessibility-test-framework-1.0" level="project" />
107+
<orderEntry type="library" exported="" scope="TEST" name="ant-launcher-1.8.0" level="project" />
108+
<orderEntry type="library" exported="" scope="TEST" name="robolectric-3.0" level="project" />
110109
<orderEntry type="library" exported="" scope="TEST" name="bcprov-jdk16-1.46" level="project" />
111-
<orderEntry type="library" exported="" scope="TEST" name="shadows-support-v4-3.0-rc3" level="project" />
112110
<orderEntry type="library" exported="" scope="TEST" name="asm-util-5.0.1" level="project" />
113111
<orderEntry type="library" exported="" scope="TEST" name="maven-ant-tasks-2.1.3" level="project" />
114112
<orderEntry type="library" exported="" scope="TEST" name="sqlite4java-0.282" level="project" />
115113
<orderEntry type="library" exported="" name="support-v4-22.1.1" level="project" />
114+
<orderEntry type="library" exported="" scope="TEST" name="robolectric-resources-3.0" level="project" />
116115
<orderEntry type="library" exported="" scope="TEST" name="mockable-android-22" level="project" />
117-
<orderEntry type="library" exported="" scope="TEST" name="shadows-core-3.0-rc3" level="project" />
116+
<orderEntry type="library" exported="" scope="TEST" name="robolectric-annotations-3.0" level="project" />
118117
<orderEntry type="module" module-name="onesignal" exported="" />
119118
</component>
120119
</module>

OneSignalSDK/app/build.gradle

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ android {
66

77
defaultConfig {
88
applicationId "com.onesignal.example"
9-
manifestPlaceholders = [manifestApplicationId:"${applicationId}"]
9+
manifestPlaceholders = [manifestApplicationId: "${applicationId}"]
1010
minSdkVersion 10
1111
targetSdkVersion 22
1212
versionCode 1
@@ -23,13 +23,11 @@ android {
2323
dependencies {
2424
compile fileTree(dir: 'libs', include: ['*.jar'])
2525
compile 'com.android.support:appcompat-v7:22.1.1'
26-
2726
//compile 'com.onesignal:OneSignal:1.8.1+@aar'
2827
compile project(':onesignal')
29-
3028
testCompile 'junit:junit:4.12'
31-
testCompile 'org.robolectric:shadows-support-v4:3.0-rc3'
32-
testCompile('org.robolectric:robolectric:3.0-rc3') {
29+
// testCompile 'org.robolectric:shadows-support-v4:3.0'
30+
testCompile('org.robolectric:robolectric:3.0') {
3331
exclude group: 'commons-logging', module: 'commons-logging'
3432
exclude group: 'org.apache.httpcomponents', module: 'httpclient'
3533
}

OneSignalSDK/app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
<application
1111
android:allowBackup="true"
12-
android:icon="@mipmap/ic_launcher"
12+
android:icon="@drawable/ic_launcher"
1313
android:label="@string/app_name"
1414
android:theme="@style/AppTheme" >
1515

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
/**
2+
* Modified MIT License
3+
*
4+
* Copyright 2015 OneSignal
5+
*
6+
* Portions Copyright 2013 Google Inc.
7+
* This file includes portions from the Google GcmClient demo project
8+
*
9+
* Permission is hereby granted, free of charge, to any person obtaining a copy
10+
* of this software and associated documentation files (the "Software"), to deal
11+
* in the Software without restriction, including without limitation the rights
12+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
* copies of the Software, and to permit persons to whom the Software is
14+
* furnished to do so, subject to the following conditions:
15+
*
16+
* 1. The above copyright notice and this permission notice shall be included in
17+
* all copies or substantial portions of the Software.
18+
*
19+
* 2. All copies of substantial portions of the Software may only be used in connection
20+
* with services provided by OneSignal.
21+
*
22+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28+
* THE SOFTWARE.
29+
*/
30+
131
package com.onesignal.example;
232

333
import android.app.Activity;

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

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
/**
2+
* Modified MIT License
3+
*
4+
* Copyright 2015 OneSignal
5+
*
6+
* Portions Copyright 2013 Google Inc.
7+
* This file includes portions from the Google GcmClient demo project
8+
*
9+
* Permission is hereby granted, free of charge, to any person obtaining a copy
10+
* of this software and associated documentation files (the "Software"), to deal
11+
* in the Software without restriction, including without limitation the rights
12+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
* copies of the Software, and to permit persons to whom the Software is
14+
* furnished to do so, subject to the following conditions:
15+
*
16+
* 1. The above copyright notice and this permission notice shall be included in
17+
* all copies or substantial portions of the Software.
18+
*
19+
* 2. All copies of substantial portions of the Software may only be used in connection
20+
* with services provided by OneSignal.
21+
*
22+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28+
* THE SOFTWARE.
29+
*/
30+
131
package com.onesignal.example;
232

333
import android.app.Activity;
@@ -37,8 +67,9 @@ protected void onCreate(Bundle savedInstanceState) {
3767
// Pass in your app's Context, Google Project number, OneSignal App ID, and a NotificationOpenedHandler
3868
OneSignal.init(this, "703322744261", "b2f7f966-d8cc-11e4-bed1-df8f05be55ba", new ExampleNotificationOpenedHandler());
3969
//OneSignal.init(this, "703322744261", "5eb5a37e-b458-11e3-ac11-000c2940e62c", new ExampleNotificationOpenedHandler());
40-
OneSignal.enableInAppAlertNotification(true);
70+
OneSignal.enableInAppAlertNotification(false);
4171
OneSignal.enableNotificationsWhenActive(false);
72+
OneSignal.sendTag("test1", "test1");
4273
//OneSignal.setSubscription(false);
4374

4475
// OneSignal.idsAvailable(new OneSignal.IdsAvailableHandler() {

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
/**
2+
* Modified MIT License
3+
*
4+
* Copyright 2015 OneSignal
5+
*
6+
* Portions Copyright 2013 Google Inc.
7+
* This file includes portions from the Google GcmClient demo project
8+
*
9+
* Permission is hereby granted, free of charge, to any person obtaining a copy
10+
* of this software and associated documentation files (the "Software"), to deal
11+
* in the Software without restriction, including without limitation the rights
12+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
* copies of the Software, and to permit persons to whom the Software is
14+
* furnished to do so, subject to the following conditions:
15+
*
16+
* 1. The above copyright notice and this permission notice shall be included in
17+
* all copies or substantial portions of the Software.
18+
*
19+
* 2. All copies of substantial portions of the Software may only be used in connection
20+
* with services provided by OneSignal.
21+
*
22+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28+
* THE SOFTWARE.
29+
*/
30+
131
package com.onesignal.example;
232

333
import android.app.Activity;

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
/**
2+
* Modified MIT License
3+
*
4+
* Copyright 2015 OneSignal
5+
*
6+
* Portions Copyright 2013 Google Inc.
7+
* This file includes portions from the Google GcmClient demo project
8+
*
9+
* Permission is hereby granted, free of charge, to any person obtaining a copy
10+
* of this software and associated documentation files (the "Software"), to deal
11+
* in the Software without restriction, including without limitation the rights
12+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
* copies of the Software, and to permit persons to whom the Software is
14+
* furnished to do so, subject to the following conditions:
15+
*
16+
* 1. The above copyright notice and this permission notice shall be included in
17+
* all copies or substantial portions of the Software.
18+
*
19+
* 2. All copies of substantial portions of the Software may only be used in connection
20+
* with services provided by OneSignal.
21+
*
22+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28+
* THE SOFTWARE.
29+
*/
30+
131
package com.onesignal.example;
232

333
import android.content.Context;

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

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
/**
2+
* Modified MIT License
3+
*
4+
* Copyright 2015 OneSignal
5+
*
6+
* Portions Copyright 2013 Google Inc.
7+
* This file includes portions from the Google GcmClient demo project
8+
*
9+
* Permission is hereby granted, free of charge, to any person obtaining a copy
10+
* of this software and associated documentation files (the "Software"), to deal
11+
* in the Software without restriction, including without limitation the rights
12+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
* copies of the Software, and to permit persons to whom the Software is
14+
* furnished to do so, subject to the following conditions:
15+
*
16+
* 1. The above copyright notice and this permission notice shall be included in
17+
* all copies or substantial portions of the Software.
18+
*
19+
* 2. All copies of substantial portions of the Software may only be used in connection
20+
* with services provided by OneSignal.
21+
*
22+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28+
* THE SOFTWARE.
29+
*/
30+
131
package com.onesignal.example;
232

333
import android.content.BroadcastReceiver;
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading
Loading

OneSignalSDK/app/src/main/res/layout/activity_main.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
android:paddingTop="@dimen/activity_vertical_margin"
66
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">
77

8-
<TextView android:text="@string/hello_world" android:layout_width="wrap_content"
8+
<TextView android:layout_width="wrap_content"
99
android:layout_height="wrap_content"
1010
android:id="@+id/textView"/>
1111

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<resources>
2-
<string name="app_name">OneSignalExample</string>
2+
<string name="app_name">OneSignal Example</string>
33

4-
<string name="hello_world">Hello world!</string>
54
<string name="action_settings">Settings</string>
65
<string name="title_activity_main_activity2">MainActivity2Activity</string>
76
</resources>
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/**
2+
* Modified MIT License
3+
*
4+
* Copyright 2015 OneSignal
5+
*
6+
* Portions Copyright 2013 Google Inc.
7+
* This file includes portions from the Google GcmClient demo project
8+
*
9+
* Permission is hereby granted, free of charge, to any person obtaining a copy
10+
* of this software and associated documentation files (the "Software"), to deal
11+
* in the Software without restriction, including without limitation the rights
12+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
* copies of the Software, and to permit persons to whom the Software is
14+
* furnished to do so, subject to the following conditions:
15+
*
16+
* 1. The above copyright notice and this permission notice shall be included in
17+
* all copies or substantial portions of the Software.
18+
*
19+
* 2. All copies of substantial portions of the Software may only be used in connection
20+
* with services provided by OneSignal.
21+
*
22+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28+
* THE SOFTWARE.
29+
*/
30+
31+
package com.onesignal;
32+
33+
import android.content.Context;
34+
35+
import com.google.android.gms.gcm.GoogleCloudMessaging;
36+
37+
import org.robolectric.annotation.Implementation;
38+
import org.robolectric.annotation.Implements;
39+
import org.robolectric.annotation.RealObject;
40+
import org.robolectric.internal.ShadowExtractor;
41+
42+
import static org.robolectric.Shadows.shadowOf;
43+
44+
@Implements(GoogleCloudMessaging.class)
45+
public class ShadowGoogleCloudMessaging {
46+
public static boolean exists = true;
47+
48+
@Implementation
49+
public static synchronized GoogleCloudMessaging getInstance(Context context) throws ClassNotFoundException {
50+
if (!exists)
51+
throw new ClassNotFoundException();
52+
53+
// This does not quite do what the real GoogleCloudMessaging.getInstance(Context) does but seems close enought.
54+
return new GoogleCloudMessaging();
55+
56+
// @RealObject does not work with static methods, even if I create an instance with new then get it from the object.
57+
// Last thing to try if this is needed is to use reflection.
58+
//GoogleCloudMessaging gcm = new GoogleCloudMessaging();
59+
//ShadowGoogleCloudMessaging shadowOfGcm = (ShadowGoogleCloudMessaging)ShadowExtractor.extract(gcm);
60+
61+
//return shadowOfGcm.realInstance.getInstance(context);
62+
//return com.google.android.gms.gcm.GoogleCloudMessaging.getInstance(context);
63+
//return GoogleCloudMessaging.getInstance(context);
64+
}
65+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/**
2+
* Modified MIT License
3+
*
4+
* Copyright 2015 OneSignal
5+
*
6+
* Portions Copyright 2013 Google Inc.
7+
* This file includes portions from the Google GcmClient demo project
8+
*
9+
* Permission is hereby granted, free of charge, to any person obtaining a copy
10+
* of this software and associated documentation files (the "Software"), to deal
11+
* in the Software without restriction, including without limitation the rights
12+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13+
* copies of the Software, and to permit persons to whom the Software is
14+
* furnished to do so, subject to the following conditions:
15+
*
16+
* 1. The above copyright notice and this permission notice shall be included in
17+
* all copies or substantial portions of the Software.
18+
*
19+
* 2. All copies of substantial portions of the Software may only be used in connection
20+
* with services provided by OneSignal.
21+
*
22+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
28+
* THE SOFTWARE.
29+
*/
30+
31+
package com.onesignal;
32+
33+
import android.content.Context;
34+
35+
import com.google.android.gms.common.ConnectionResult;
36+
import com.google.android.gms.common.GooglePlayServicesUtil;
37+
38+
import org.robolectric.annotation.Implements;
39+
40+
@Implements(GooglePlayServicesUtil.class)
41+
public class ShadowGooglePlayServicesUtil {
42+
43+
public static int isGooglePlayServicesAvailable(Context context) {
44+
return ConnectionResult.SUCCESS;
45+
}
46+
}

0 commit comments

Comments
 (0)