Minimize Application

Is there a Javascript function or code that will minimize the application? I posted earlier about “closing” the application and learned this is not allowed.

Maybe I am answering my own thread. lol

form1.hide(); ??

What platform? The behavior is different.

I just implemented Form1.Hide() and compiled in PhoneGap and it is working beautifully in both IOS and Android platforms. I just needed to dig a little bit! Thanks for the response.

Actually, it hides the Form but loses all of its objects. Back to drawing Board or live with this behavior.

I’m not sure what you mean by minimizing an app in iOS or Android. You just switch to the new app: the old one continues to run in the background.

I should have articulated more, and now I have found a fix. Here is the scoop for perhaps others to benefit from: I built a web app and I just needed an app that could be installed that simply had a button on it to Launch to that web application in Android or IPhones. I used the Cordova InAppBrowser with the URL passed in.

    var ref = cordova.InAppBrowser.open(url, '_system', 'location=no');
    ref.addEventListener('loadstart', function() { alert(event.url); });

The parameter “_System” will open the web page from the button click on the NSBASIC/PHONEGAP application in the native browser of the OS on that device. This works all fine, but on the IPhone, the window would open “behind” the main Mobile application screen that showed the button, or, the “Form1” of the application.

I added the following after the lines of code above to hide “Form1” so the InAppBrowser window would appear “on top” else everyone thought it wasn’t working.

Form1.hide();

By doing that, the Button Object and Container holding some text would also disappear, so if they returned to this after closing the InAppBrowser window, they would not see the button again.

I found a fix, funny enough, by simply showing the form again. So here is all the code that is needed to build a mobile app that simply launches to a web page or web application, brings the windows to the front, and keeps the application loaded behind the native web browser window of each device type, and when returning the button is still showing:

function ShowImage(url) {

  try {
    var ref = cordova.InAppBrowser.open(url, '_system', 'location=no');
    ref.addEventListener('loadstart', function() { alert(event.url); });
   Form1.hide();
  }
  catch (e) {
      NSB.MsgBox(e);
   }

 Form1.show();

};

1 Like

This may sound like an oversimplification… but this app went to 200 users in a middle market company and people were complaining about typing the URL to get to the web app!

Now I understand! Thank you.

Hi,
Why not just save the web site to the home screen after first opening? Too difficult for the users?
Thomas

If you’re not compiling into an actual app (and I would), I’d see if this would work:

https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/bookmarks/create

Or