Native app not working with low signal

0
Hello,    We have a native application that works perfectly online, works perfectly offline but we have been testing the app with low signal the app get blocked waiting for the data update.   The nanoflows that we are using to update the data are these:   Are there any way to force the flow to go offline when the signal is low or control the waiting time to force to go offline when the process is lasting too much?    Thank you very much.        
asked
1 answers
0

Finally, we did a javascript action to calculate the time that takes the app to download a image from internet, it returns a boolean with false value if the time is over 2500 mlsec:

 

export async function ACT_IsGoodConnection(maxTimeConn) {

// BEGIN USER CODE

const maxTimeGoodConnection = Number(maxTimeConn);

const startTime = Date.now();

 

return Promise.race([

fetch('YOUR_FILE_TO_DOWNLOAD')

.then(response => {

const endTime = Date.now();

const totalTime = endTime - startTime;

return totalTime < maxTimeGoodConnection;

}),

new Promise((_, reject) => setTimeout(() => reject('Timeout'), maxTimeGoodConnection))

])

.catch(error => {

return false;

});

 

The parameter is a costant where you can choose the time that you can consider slow.

 

 Regards.

answered