Hello guys. So am developing an Android App using the phonegap.jar library as well as cordova js as instructed. I am basically picking contents from my server/ The issue come is that the app having compiled well, crashes on Some devices, typically with the message that the App has stopped working. I ran the logcats and this is the message i got from the moment of the crash:
FATAL EXCEPTION: main
11-25 10:27:13.000 9934 9934 E AndroidRuntime: Process: com.app.package, PID: 9934
11-25 10:27:13.000 9934 9934 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.phonegap.CallbackServer.sendJavascript(java.lang.String)' on a null object reference
11-25 10:27:13.000 9934 9934 E AndroidRuntime: at com.phonegap.DroidGap$LinearLayoutSoftKeyboardDetect.onMeasure(DroidGap.java:1699)
public class Main extends DroidGap {
ConnectivityManager connectivity;
NetworkInfo activeNetwork;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
super.setIntegerProperty("splashscreen", R.drawable.splash);
connectivity = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
activeNetwork = connectivity.getActiveNetworkInfo();
if(activeNetwork != null) {
if(activeNetwork.getType() == ConnectivityManager.TYPE_WIFI)
{Toast.makeText(this,activeNetwork.getTypeName(), Toast.LENGTH_SHORT).show();
super.loadUrl("URL", 1000);}
else if(activeNetwork.getType() == ConnectivityManager.TYPE_MOBILE)
{Toast.makeText(this, activeNetwork.getTypeName(), Toast.LENGTH_SHORT).show();
super.loadUrl("URL", 1000);}
}//Connected to the Internet
else {
super.loadUrl("file:///android_asset/www/index.html", 1000);}
//No Internet Connection
}
public void onReceivedError( int errorCode, String description, String failingUrl)
{
super.loadUrl("file:///android_asset/www/index.html", 1000);
//Server down.
}
}
What am not sure of, is it that i need to update phonegap. How would this be done since i cannot even find any latest phonegap jars.
Thank you.