Brian de Alwis created CB-8536: ---------------------------------- Summary: Splash screens not found on Android when application package name differs from class package name Key: CB-8536 URL: https://issues.apache.org/jira/browse/CB-8536 Project: Apache Cordova Issue Type: Bug Components: CordovaLib, Plugin SplashScreen Affects Versions: 3.6.0 Environment: Android Reporter: Brian de Alwis Priority: Minor
Application splash screens are not found on Android when using a package id that differs from the class package structure. The diagnosis as reported elsewhere (http://stackoverflow.com/a/27378129/600339) is that the splash screens are resolved from CordovaActivity using getClass().getPackage().getName() rather than getPackageName(). With CB-3679 this code has been moved into the SplashScreen plugin. --- CordovaLib/src/org/apache/cordova/CordovaActivity.java +++ CordovaLib/src/org/apache/cordova/CordovaActivity.java @@ -23,9 +23,6 @@ import java.util.HashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; -import org.apache.cordova.CordovaInterface; -import org.apache.cordova.CordovaPlugin; -import org.apache.cordova.LOG; import org.json.JSONException; import org.json.JSONObject; @@ -362,7 +359,9 @@ public class CordovaActivity extends Activity implements CordovaInterface { String splash = preferences.getString("SplashScreen", null); if(this.splashscreenTime > 0 && splash != null) { - this.splashscreen = getResources().getIdentifier(splash, "drawable", getClass().getPackage().getName());; + // Use configured package name rather than class package name + // http://stackoverflow.com/a/27378129/600339 + this.splashscreen = getResources().getIdentifier(splash, "drawable", getPackageName()); if(this.splashscreen != 0) { this.showSplashScreen(this.splashscreenTime); @@ -1021,7 +1020,7 @@ public class CordovaActivity extends Activity implements CordovaInterface { if (this.splashDialog == null || !this.splashDialog.isShowing()) { String splashResource = preferences.getString("SplashScreen", null); if (splashResource != null) { - splashscreen = getResources().getIdentifier(splashResource, "drawable", getClass().getPackage().getName()); + splashscreen = getResources().getIdentifier(splashResource, "drawable", getPackageName()); } this.showSplashScreen(this.splashscreenTime); } -- This message was sent by Atlassian JIRA (v6.3.4#6332) --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org For additional commands, e-mail: issues-h...@cordova.apache.org