Home Execute code in background app
Reply: 0

Execute code in background app

arnoldssss
1#
arnoldssss Published in 2018-01-13 06:23:42Z

I have an application made in cordova and angular. I make some custom url schemes and I make one application to be executed in background and one app in foreground.

What I want to achieve: the application in foreground executes code from the background one without the user notices.

  1. App1 (Visible) calls deeplink to App2
  2. App2 execute a service and calls deeplink to App1 ( this service calls a library in a cordova plugin gives the value back to App1 )
  3. App1 receives the value and print it

So I achieve the three points up there but for some reason the App1 sometimes wants to open the background app (App2) , is a thing of 1 sec or 2 but visible, I want to enforce the App1 to be always on foreground. Is there a way to do this even if I use deeplinks?

in the index is something like:

<script>


document.addEventListener('deviceready', function () {
   cordova.plugins.backgroundMode.moveToForeground();
}, false);


function handleOpenURL (url) {
   cordova.plugins.backgroundMode.moveToForeground();
  console.log(url)
};

</script>

The button to call the deeplink has this code:

       $scope.iniciar = function (){

       $window.open = cordova.InAppBrowser.open;

       $window.open('bem://', '_system');
       //cordova.plugins.backgroundMode.moveToForeground();

       }; 
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.965304 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO