문제

I want to create a splash screen in cordova and at the same time while loading splash screen I want to call web services in background. so is this feasible in cordova ? I am new to cordova.Please let me know if there is any possibilities .Thanks in advance .

도움이 되었습니까?

해결책

For Android, put your splash screen images under res/drawable folders. To show splash screen add below line before loadUrl, in your ProjectName.java class(the one extending CordovaActivity).

super.setIntegerProperty("splashscreen", R.drawable.splashscreen); //R.drawable.your_image_name

From that point you have two options.

  1. Show splashscreen for fixed amount of time:

    super.loadUrl("file:///android_asset/www/index.html", 3000); //this will show 3sec

  2. Do something in JavaScript then close splash manually, call loadUrl without timeout. You can call below anytime in your JS code to close splashscreen:

    navigator.splashscreen.hide();

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top