Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Incomplete
-
3.6.0
-
None
-
Android
Description
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())Unknown macro: { 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); }