Always redirect to a microflow on opening the mobile app

0
Hi,  I want to call a microflow(which will load data and open the homepage) every time the user opens the app on his phone. We have built hybrid apps for both android and the iPhone. The issue is, if the user goes to any random page and then minimizes the app, the next time when he opens the app, the last open page loads up and is unable to load the data(may be it's lost) and the users sees a error popup. Please suggest the best way to do carry this out.
asked
2 answers
3

In Cordova, there in a JavaScript function called when you resume your app. So, add a JavaScript snippet to your mobile page layout with something like this:

 

document.addEventListener("resume", mxOnResume, false);

function mxOnResume() {
    mx.data.action({
        params: {
            actionname: "MyFirstModule.DoSomething"
        },
        origin: this.mxform,
        callback: function(obj) {
            // no MxObject expected
            console.log("We just did something!")
        },
        error: function(error) {
            console.log(error.message);
        },
        onValidation: function(validations) {
            console.log("There were " + validation.length + " validation errors");
        }
    });
}

 

answered
0

Hi Romil,

 In your navigation profiles, you can set the homepage to a microflow. This way you can handle which page will be shown to a user. The microflow will execute every time a user comes to the application or hits the home button. 

answered