1. Marc James
  2. PowerServer Mobile (Obsolete)
  3. Friday, 15 November 2019 17:47 PM UTC

Hi, I am uploading an image to my server from a mobile, I would like to display a loading gif while it uploads the file, then hide the gif when it is done.. 

For some reason a gif worked on desktop/internet, but it did not animate when on my mobile phone (google pixel XL 3)

So instead I just thought i'd animate a loading bar moving up and then resetting itself on a timer, then when the upload is complete, the bar is hidden and then a popup comes up saying upload complete. (see code below where I call the timer just before I upload to the IIS server)

ls_directory = "regen/"
inv_file.of_logonfileserver( '000.148.152.100', 80, 'username=0;password=0' )
st_uploading.visible = true
hpb_uploading.visible = true
timer(0.5,w_mobile)
inv_file.of_appeonupload( is_photo1, ls_directory, true, ll_error )
timer(0,w_mobile)
st_uploading.visible = false
hpb_uploading.visible = false
inv_file.of_logofffileserver()

THE PROBLEM

What I found though was that the loading bar would appear along with its title, but the bar would only go up by 10, then just stop. So it seems the timer only triggers once, even thought it is supposed to go round every 0.5 seconds. Below is the simple code my timer does to increment by 10.

long ll_position = 0

hpb_uploading.position = ll_position

IF ll_position = 0 THEN
	ll_position = 10
ELSEIF ll_position = 10 THEN
	ll_position = 20
ELSEIF ll_position = 20 THEN
	ll_position = 30
ELSEIF ll_position = 30 THEN
	ll_position = 40
ELSEIF ll_position = 40 THEN
	ll_position = 50
ELSEIF ll_position = 50 THEN
	ll_position = 60
ELSEIF ll_position = 60 THEN
	ll_position = 70
ELSEIF ll_position = 70 THEN
	ll_position = 80
ELSEIF ll_position = 80 THEN
	ll_position = 90
ELSEIF ll_position = 90 THEN
	ll_position = 100
ELSEIF ll_position = 100 THEN
	ll_position = 0
END IF
	
hpb_uploading.position = ll_position

And below is the screenshot of the app.

Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Friday, 15 November 2019 20:51 PM UTC
  2. PowerServer Mobile (Obsolete)
  3. # 1

Hi Marc;

   The same happens in native PB Apps when you perform long service requests like: a) Along DBMS request; b) Blob processing; c) Web Service calls, etc. Its because the "Main" task is giving control to a "Sub-Task" and then the main task is processing is paused by the hos O/S (hence to timers, no animated GIF's, etc will run) until the sub-task is completed and returns control back to the main task.

   You can get around this issue in native PB Apps by using the multi-threading feature of PB (ie: SharedObjects) but on iOS and Android O/S, the multi-threading feature is not supported.

Regards ... Chris

Comment
  1. Marc James
  2. Monday, 18 November 2019 11:15 AM UTC
Okay Chris thanks, i'll stick to "Uploading 1/9, please wait..." ....... "Uploading 2/9, please wait..."
  1. Helpful
There are no comments made yet.
Marc James Accepted Answer Pending Moderation
  1. Friday, 15 November 2019 18:00 PM UTC
  2. PowerServer Mobile (Obsolete)
  3. # 2

Of course, I forgot to mention, if you could think of another suitable good looking way of animating while uploading, I am up for suggestions. Thanks

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.