GurstTavo
GurstTavo

Reputation: 334

Ionic multiple splash screens

I'm building an application with Ionic v1 and using the cordova splash-screen plug-in.
I need to show a splash screen form a fixed set of images each time the app starts.

Is there any way, clean or hackish to get multiple splash-screens?

Thanks for any help.

Upvotes: 4

Views: 941

Answers (2)

Deepika
Deepika

Reputation: 460

It's not possible with Cordova Splash Screen plugin but you can try this.

First we will create array of images :

$rootScope.image = ["img1.png","img2.png"];

And set/reset index for picking image :

if(localStorage.getItem('sliderIndex')==null || localStorage.getItem('sliderIndex')==undefined || localStorage.getItem('sliderIndex')==5) localStorage.setItem('sliderIndex',0);

Here is your view page

<img src="img/{{image[imgIndex]}}" width="100%" height="100%"/>

And set imgIndex's value :

$scope.imgIndex = localStorage.getItem('sliderIndex');

And navigate the page after 3 sec, incrementing the index value :

$timeout(function() {
  $location.path("/app/search");
  var data = parseInt(localStorage.getItem('sliderIndex'))+1;
  localStorage.setItem('sliderIndex',data);},3000);

Upvotes: 1

Sachin Gawai
Sachin Gawai

Reputation: 381

you have to maintain image displayed on splash screen in Local storage.

e.g suppose images array contains [1.png,2.png,3.png,4.png,5.png] so when if I displayed 1.png first time then will save that in local storage and when next time splash screen gets appeared check that local storage and increment it by 1 and so on... till last image,if on last image set first image again

Upvotes: 0

Related Questions