Mobile: Best method for a-sync client action during page load


I would like to start an client action during the load of the screen. This action will query some device sensors (mainly location) and can take some time. I do not want to stall the loading of the screen due to these actions but seem to find that by adding this action to the "On Initialize", "On Ready" or "On Render" it does cause stalling and I suspect that it is run synchronously. Service Center also tells me that stalling will occur in the warning pane.

The only way that I can think of now to achieve this is to query a empty table with the "Fetch data from ..." action and then use the "On After Fetch" to start my client action. This feels not natural and I wonder if there are better methods to achieve what I want. Any suggestions?

ps, It's an enterprise app where the usage of the location services are a business requirement. Every user will be told that the app will collect location data without any prompt since that is part of its core functions.

There is a big set of best practices located here:   I think that this has some information that will help you.

I read through that document before posting this. I should have mentioned that. 

Anyhow, this document doesn't mention my use case and doesn't help me further.

Just a small after weekend bump to get a bit more visibility. I'm hoping that someone has a nice method to do what I seek.

Hi Vicent,

I already did something like that. You can create an Asynchronous action, read this link:

"When one of "$resolve()" or "$reject()" predefined functions is used in a given JavaScript element, the client action the element belongs to will be considered asynchronous."

I hope this can help you.

Regards, Paulo