Any idea to redirect to index page when launch app from URL SCHEMA?



I implement a Custom-URL-scheme plugin for my ionic app.

I launch the app by the url scheme when the app is running on background.
So the app will redirect to index page rather than stay on the current page before go to background.

I can tracker the event of launch the app from the URL scheme by the global function “handleOpenURL”.
But it will redirect after animation…

Can It redirect to the index page before render the view??

So that the user will not see the redirect animation.

#I am working with IOS#
#Thanks…a lot#

Current state:

Current app.js:

(function () {

    var app = angular.module('mainApp', ['ionic',

    app.config(function ($stateProvider, $urlRouterProvider) {

    app.controller('mainViewsController', function ($scope, $state) {

        $scope.launchFromURL = function (url) {
            console.log("is launch from url: " + url);
            alert("from URL: " + url);

    }); ($ionicPlatform) {
        $ionicPlatform.ready(function () {

            if (window.cordova && window.cordova.plugins.Keyboard) {
            if (window.StatusBar) {


function handleOpenURL(url) {
    var body = document.getElementsByTagName("body")[0];
    var scope = angular.element(body).scope();
    setTimeout(function () {
    }, 0);