@@ -40,9 +40,12 @@ public class OneSignalEditorScriptAndroid : AssetPostprocessor {
40
40
public static object svcSupport ;
41
41
42
42
private static readonly string PluginName = "OneSignal" ;
43
- // If you run into conflicts OneSignal supports back to version 9.0.0.
44
- private static readonly string PLAY_SERVICES_VERSION = "10.0.+" ;
45
- private static readonly string ANDROID_SUPPORT_VERSION = "24.0.+" ;
43
+
44
+ // Both are set to LATEST to ensure compability between other plugins.
45
+ // PLAY_SERVICES_VERSION - Tested with versions 10.2.1 to 11.2.0
46
+ // ANDROID_SUPPORT_VERSION - Tested with versions 26.0.0 through 26.0.1
47
+ private static readonly string PLAY_SERVICES_VERSION = "+" ;
48
+ private static readonly string ANDROID_SUPPORT_VERSION = "+" ;
46
49
47
50
static OneSignalEditorScriptAndroid ( ) {
48
51
createOneSignalAndroidManifest ( ) ;
@@ -96,22 +99,22 @@ private static void addGMSLibrary() {
96
99
namedArgs : new Dictionary < string , object > ( ) {
97
100
{ "packageIds" , new string [ ] { "extra-android-m2repository" } }
98
101
} ) ;
99
-
100
- // Adds play-services-base, play-services-basement, play-services-iid, and support-v4 will be automaticly added.
101
- // Also adds play-services-tasks but this isn't used by OneSignal, it just added as a depency from the above.
102
-
103
-
104
- // Setting 8.3+ does not work with unity-jar-resolver-1.2.0 and GooglePlayGamesPlugin-0.9.34.
105
- // It creates conflicting aar files with mismatched version of 8.4 and 9.4
106
- // svcSupport.DependOn("com.google.android.gms", "play-services-gcm", "8.3+");
107
- // svcSupport.DependOn("com.google.android.gms", "play-services-location", "8.3+");
108
- // play-services-base, play-services-basement, and support-v4 will be automaticly added.
109
- // play-services-maps and play-services-measurement are not used by OneSignal
110
- // but are included as depencies from the other parts of play-services.
102
+
103
+
104
+ Google . VersionHandler . InvokeInstanceMethod (
105
+ svcSupport , "DependOn" ,
106
+ new object [ ] {
107
+ "com.android.support" ,
108
+ "support-v4" ,
109
+ ANDROID_SUPPORT_VERSION
110
+ } ,
111
+ namedArgs : new Dictionary < string , object > ( ) {
112
+ { "packageIds" , new string [ ] { "extra-android-m2repository" } }
113
+ } ) ;
111
114
}
112
115
113
116
// Copies `AndroidManifestTemplate.xml` to `AndroidManifest.xml`
114
- // then replace `${manifestApplicationId}` with current packagename in the Unity settings.
117
+ // then replace `${manifestApplicationId}` with current packagename in the Unity settings.
115
118
private static void createOneSignalAndroidManifest ( ) {
116
119
string oneSignalConfigPath = "Assets/Plugins/Android/OneSignalConfig/" ;
117
120
string manifestFullPath = oneSignalConfigPath + "AndroidManifest.xml" ;
@@ -125,7 +128,7 @@ private static void createOneSignalAndroidManifest() {
125
128
#if UNITY_5_6_OR_NEWER
126
129
body = body . Replace ( "${manifestApplicationId}" , PlayerSettings . applicationIdentifier ) ;
127
130
#else
128
- body = body . Replace ( "${manifestApplicationId}" , PlayerSettings . bundleIdentifier ) ;
131
+ body = body . Replace ( "${manifestApplicationId}" , PlayerSettings . bundleIdentifier ) ;
129
132
#endif
130
133
using ( var streamWriter = new StreamWriter ( manifestFullPath , false ) ) {
131
134
streamWriter . Write ( body ) ;
0 commit comments