Skip to content

Commit f61557a

Browse files
committed
Updated Eclipse example project
1 parent 8db735d commit f61557a

File tree

7 files changed

+58
-23
lines changed

7 files changed

+58
-23
lines changed

Examples/Eclipse/OneSignalExample/.classpath

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,6 @@
55
<classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.DEPENDENCIES"/>
66
<classpathentry kind="src" path="src"/>
77
<classpathentry kind="src" path="gen"/>
8-
<classpathentry exported="true" kind="lib" path="../OneSignalSDK/bin/onesignalsdk.jar"/>
8+
<classpathentry exported="true" kind="lib" path="C:/OneSignalPublicRepos/OneSignal-Android-SDK2/OneSignalSDK.jar"/>
99
<classpathentry kind="output" path="bin/classes"/>
1010
</classpath>

Examples/Eclipse/OneSignalExample/AndroidManifest.xml

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,27 @@
2525
Vibration settings of the device still apply. -->
2626
<uses-permission android:name="android.permission.VIBRATE" />
2727

28+
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
29+
30+
<!-- START: ShortcutBadger -->
31+
<!--for Samsung-->
32+
<uses-permission android:name="com.sec.android.provider.badge.permission.READ"/>
33+
<uses-permission android:name="com.sec.android.provider.badge.permission.WRITE"/>
34+
35+
<!--for htc-->
36+
<uses-permission android:name="com.htc.launcher.permission.READ_SETTINGS"/>
37+
<uses-permission android:name="com.htc.launcher.permission.UPDATE_SHORTCUT"/>
38+
39+
<!--for sony-->
40+
<uses-permission android:name="com.sonyericsson.home.permission.BROADCAST_BADGE"/>
41+
42+
<!--for apex-->
43+
<uses-permission android:name="com.anddoes.launcher.permission.UPDATE_COUNT"/>
44+
45+
<!--for solid-->
46+
<uses-permission android:name="com.majeur.launcher.permission.UPDATE_BADGE"/>
47+
<!-- End: ShortcutBadger -->
48+
2849
<!-- ##END## OneSignal Permissions -->
2950

3051
<application
@@ -48,7 +69,10 @@
4869
<meta-data android:name="com.google.android.gms.version"
4970
android:value="@integer/google_play_services_version" />
5071

51-
<activity android:name="com.onesignal.NotificationOpenedActivity"/>
72+
<meta-data android:name="onesignal_app_id"
73+
android:value="b2f7f966-d8cc-11e4-bed1-df8f05be55ba" />
74+
<meta-data android:name="onesignal_google_project_number"
75+
android:value="str:703322744261" />
5276

5377
<receiver
5478
android:name="com.onesignal.GcmBroadcastReceiver"
@@ -58,7 +82,11 @@
5882
<category android:name="com.onesignal.example" />
5983
</intent-filter>
6084
</receiver>
61-
<service android:name="com.onesignal.GcmIntentService" />
85+
86+
<receiver android:name="com.onesignal.NotificationOpenedReceiver" />
87+
<service android:name="com.onesignal.GcmIntentService" />
88+
<service android:name="com.onesignal.SyncService" android:stopWithTask="false" />
89+
<activity android:name="com.onesignal.PermissionsActivity" android:theme="@android:style/Theme.Translucent.NoTitleBar" />
6290

6391
<!-- Optional receiver to get OneSignal Background Data Notifications. -->
6492
<receiver
@@ -68,6 +96,7 @@
6896
<action android:name="com.onesignal.BackgroundBroadcast.RECEIVE" />
6997
</intent-filter>
7098
</receiver>
99+
71100
<!-- ##END## OneSignal -->
72101

73102
</application>
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
1. Add the latest OneSignalSDK.jar to the libs folder
2+
2. Import the google-play-services_lib project into your workspace per steps 1.2 - 1.4
3+
https://documentation.onesignal.com/docs/installing-the-onesignal-android-sdk
4+
2. Update onesignal_app_id and onesignal_google_project_number in the AndroidManifest.xml to yours.
Binary file not shown.

Examples/Eclipse/OneSignalExample/proguard-project.txt

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,22 @@
1919
# public *;
2020
#}
2121

22-
-dontwarn com.gamethrive.**
23-
-dontwarn com.onesignal.**
22+
-dontwarn com.onesignal.**
23+
24+
-keep class com.google.android.gms.common.api.GoogleApiClient {
25+
void connect();
26+
void disconnect();
27+
}
28+
29+
-keep public interface android.app.OnActivityPausedListener {*;}
30+
31+
32+
-keep class com.onesignal.shortcutbadger.impl.AdwHomeBadger { <init>(...); }
33+
-keep class com.onesignal.shortcutbadger.impl.ApexHomeBadger { <init>(...); }
34+
-keep class com.onesignal.shortcutbadger.impl.AsusHomeLauncher { <init>(...); }
35+
-keep class com.onesignal.shortcutbadger.impl.DefaultBadger { <init>(...); }
36+
-keep class com.onesignal.shortcutbadger.impl.NewHtcHomeBadger { <init>(...); }
37+
-keep class com.onesignal.shortcutbadger.impl.NovaHomeBadger { <init>(...); }
38+
-keep class com.onesignal.shortcutbadger.impl.SolidHomeBadger { <init>(...); }
39+
-keep class com.onesignal.shortcutbadger.impl.SonyHomeBadger { <init>(...); }
40+
-keep class com.onesignal.shortcutbadger.impl.XiaomiHomeBadger { <init>(...); }

Examples/Eclipse/OneSignalExample/project.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.
1212

1313
# Project target.
1414
target=android-21
15-
android.library.reference.1=../../../../../../workspace/google-play-services_lib
15+
android.library.reference.1=../../../../../Users/Josh/workspace/google-play-services_lib

Examples/Eclipse/OneSignalExample/src/com/onesignal/example/MainActivity.java

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ protected void onCreate(Bundle savedInstanceState) {
5454
// Enable Logging below to debug issues. (LogCat level, Visual level);
5555
// OneSignal.setLogLevel(OneSignal.LOG_LEVEL.DEBUG, OneSignal.LOG_LEVEL.DEBUG);
5656

57-
// Pass in your app's Context, Google Project number, OneSignal App ID, and a NotificationOpenedHandler
58-
OneSignal.init(this, "703322744261", "5eb5a37e-b458-11e3-ac11-000c2940e62c", new ExampleNotificationOpenedHandler());
57+
// Pass in your app's Context
58+
OneSignal.startInit(this).setNotificationOpenedHandler(new ExampleNotificationOpenedHandler()).init();
5959
}
6060

6161
// activity_main.xml defines the link to this method from the button.
@@ -80,21 +80,6 @@ public void idsAvailable(String userId, String registrationId) {
8080
});
8181
}
8282

83-
// onPause and onResume hooks are required so OneSignal knows when to create a notification and when to just call your callback and playtime for segmentation.
84-
// To save on adding these hooks to every Activity in your app it might be worth extending android.app.Activity to include this logic if you have many Activity classes in your App.
85-
// Anther option is to use this library https://github.com/BoD/android-activitylifecyclecallbacks-compat
86-
@Override
87-
protected void onPause() {
88-
super.onPause();
89-
OneSignal.onPaused();
90-
}
91-
92-
@Override
93-
protected void onResume() {
94-
super.onResume();
95-
OneSignal.onResumed();
96-
}
97-
9883
// NotificationOpenedHandler is implemented in its own class instead of adding implements to MainActivity so we don't hold on to a reference of our first activity if it gets recreated.
9984
private class ExampleNotificationOpenedHandler implements NotificationOpenedHandler {
10085
/**

0 commit comments

Comments
 (0)