@@ -40,9 +40,12 @@ public class OneSignalEditorScriptAndroid : AssetPostprocessor {
4040 public static object svcSupport ;
4141
4242 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 = "+" ;
4649
4750 static OneSignalEditorScriptAndroid ( ) {
4851 createOneSignalAndroidManifest ( ) ;
@@ -96,22 +99,22 @@ private static void addGMSLibrary() {
9699 namedArgs : new Dictionary < string , object > ( ) {
97100 { "packageIds" , new string [ ] { "extra-android-m2repository" } }
98101 } ) ;
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+ } ) ;
111114 }
112115
113116 // 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.
115118 private static void createOneSignalAndroidManifest ( ) {
116119 string oneSignalConfigPath = "Assets/Plugins/Android/OneSignalConfig/" ;
117120 string manifestFullPath = oneSignalConfigPath + "AndroidManifest.xml" ;
@@ -125,7 +128,7 @@ private static void createOneSignalAndroidManifest() {
125128 #if UNITY_5_6_OR_NEWER
126129 body = body . Replace ( "${manifestApplicationId}" , PlayerSettings . applicationIdentifier ) ;
127130 #else
128- body = body . Replace ( "${manifestApplicationId}" , PlayerSettings . bundleIdentifier ) ;
131+ body = body . Replace ( "${manifestApplicationId}" , PlayerSettings . bundleIdentifier ) ;
129132 #endif
130133 using ( var streamWriter = new StreamWriter ( manifestFullPath , false ) ) {
131134 streamWriter . Write ( body ) ;
0 commit comments