I have just created a splash screen in my cordova project. I was able to build and run my project initially and my splash screen was displaying. However, when I added in the cordova.jar into the project library to serve as a file dependencies for my webservice function. I kept having this syntax error in my SplashScreen.java:
error: cannot find symbol variable CORDOVA_VERSION
Following is a snippet of my code:
import org.apache.cordova.*;
import org.apache.cordova.CallbackContext;
import org.apache.cordova.CordovaPlugin;
import org.apache.cordova.CordovaWebView;
public class SplashScreen extends CordovaPlugin {
private static final String LOG_TAG = "SplashScreen";
// Cordova 3.x.x has a copy of this plugin bundled with it (SplashScreenInternal.java).
// Enable functionality only if running on 4.x.x.
private static final boolean HAS_BUILT_IN_SPLASH_SCREEN = Integer.valueOf(CordovaWebView.
CORDOVA_VERSION.split("\\.")[0]) < 4;
private static Dialog splashDialog;
private static ProgressDialog spinnerDialog;
private static boolean firstShow = true;
....
Could I receive some help to solve this issue please?
I don't know what you are trying to do exaclty but you can't do that.
You just can't CordovaWebView.CORDOVA_VERSION
.
If you really want to know what version you use programmatically, you can use this plugin
Otherwise you can just do that
PackageManager packageManager = this.cordova.getActivity().getPackageManager();
System.out.println(packageManager.versionName);
or
PackageManager packageManager = this.cordova.getActivity().getPackageManager();
packageManager.getPackageInfo(this.cordova.getActivity().getPackageName(), 0).versionName;
Dont forget to surround with try/catch.