intel xdk android mobile application when click on back it should be quit the app - intel-xdk

I am Beginer for intel xdk , i have made an app for android device, in app. i have set a button as a back button , my app have 6 pages, one of them is an index page which is load first and then navigate too the another page , when i am on index page , press a back button which inbuilt in device it redirect me on the page according to history instead of exit the app.. it behaves just like a web browser back button, because my code is in html5 format.
i want to use this button to quit from this application how can I use it or code...*/
<script>
window.history.forward();
function noBack() {
window.history.forward();
}
</script>
<body onload="noBack();" onpageshow="if (event.persisted) noBack();">

You can use the navigator.app.exitApp() function from the Cordova API if you include the cordova.js library (after the intelxdk.js library). But it only works on Android devices, it is not supported anywhere else.
You would execute this code when you capture the Android hardware back button.

Related

How to prompt "save in the home screen" in a Flutter Web App (both mobile and desktop)

Opening Flutter Gallery web app
the user get prompted to add the app to the home screen as shown below
for both desktop
and mobile
what steps should I follow to achieve this without messing with JS (js answer)
Thank you
While the popup in the image that you have mentioned , that is automatic .It automatically fires up when you meet several criteria (and which are always true for flutter web apps , mentioned here) .
code :
if ('serviceWorker' in navigator) {
window.addEventListener('load', function () {
navigator.serviceWorker.register('flutter_service_worker.js');
});
}
which is present in index.html handles the pwa functionality

Ionic Not working in safari but works in crome and android phone

I am debugging my app.
it works well in crome and my note3 phone.
but If I test in safari,
login page doesn't change to dashboard page after login but token and Id is in localStorage it just stays in login page(1).
and form gets all messed up when keyboard appears. also it doesn't looks like it follows responsive web design that I gave(2).
could solve it when I don't use location.reload() in last part of my login function after $state.go('app.dashboard') but then when I am in dashboard and click menu then it doesn't bring all the data. but if I reload menually again then it loads up and samething happens in crome.
I don't know why it does do this at all

How do I open any app from my web browser (Chrome) in Android, automatically?

I am struggling a little bit. I have a common url like www.domain.com/test.html
and i want Android users to get my app open if "test" is included, otherwise if they don't have the app their should be directed to the play store. I got everything implemented and it works with mozilla browser. But using chrome on Android it should be forbidden to automatically open the app if it is available!?. Now if the user enters www.domain.com/test.html and i recognize he is using Android and Chrome i tried the intent stuff in a script in a redirected www.domain.com/android_chrome.html:
<script> window.open("intent://scan/#Intent;scheme=zxing;package=com.google.zxing.client.android;S.browser_fallback_url=http%3A%2F%2Fzxing.org;end","_self")
</script>
But the App won't open automatically. If i use a regular Link:
Take a QR code
it works. But i want to let it open automatically!
Google restricted starting intents from javascript apps, that's why it isn't working. Security reasons I guess. You should just display nice big link to let user switch to your app instead of website - or let him continue if he doesn't want to launch the app.
Forcing users into using app is bad, IMO. Splash screen suggesting to use it is okay, but don't push it.

Not able to Close blackberry 7 browser from my code

Thanks! Hello everyone! I am making a BlackBerry 7 mobile native application. On click of button from my native application. It will be open a URL in a separate browser. So, I want to close the opened browser. The URL it is opening. This URL is separate domain, but this is my page, in this page i have tried following code. But, it is not working -
blackberry.app.exit();
window.close();
System.exit();
I have tried to open the URL in my native application using iframe. But, here always taking me splash screen instead of loading URL.
Are you using WebWorks or Cordova (nee PhoneGap) ? One solution is to use Cordova 2.9 (the last version to support BBOS) and the InAppBrowser API.

Possible to open iPhone Safari and target a specific window?

I have an app that uses OAuth to authenticate, which means the user must be directed to the website to authorize the application. I prefer to make it obvious to the user that they are using a standard browser to authorize at the original site rather than just using a web view to show the content within my app. However, every time they are directed to Safari (via openURL), it launches a new Safari window and once Safari has 8 windows open, it simply fails to work at all.
I'm wondering if there is an equivalen to the "target" attribute of an anchor tag in html which would allow me to cause all openURL calls from my application to open in the same window.
There is other functionality that I can expose via the web application, creating a hybrid app between native iphone functionality and web app functionality in Safari, but if I have to launch a new window every time I switch between the app and Safari, it becomes unworkable. The Youtube app is obviously able to return the user to the previous page after showing a video, but that might well be a custom plugin in Safari for iphone. Also, while returning to the previous page is somewhat useful, sending them to a new URL in the existing window really opens up a lot of possiblities.
I'm pretty sure there is no way to pass a target parameter to openURL:.
What I noticed about Safari is that it won't open another tab if the page you are opening with openURL: is/was already open in Safari. It just reloads that page. This might sound trivial and not helpful but perhaps you could use it to your advantage if you can make your web application only use one page. Different views or states could be expressed with #anchor tags.
An example is http://m.flickr.com. Notice their URL structure? It goes http://m.flickr.com/#/home, http://m.flickr.com/#/explore/interesting/, http://m.flickr.com/#/search and so on. All of these are different web pages to the user but to Safari it's all the same page.
I found iOS 6.0.1 Safari will open the same tab with a simple hashtag, without the slashes. So with the above example http://m.flickr.com, openURL to http://m.flickr.com#someinfo opens to the same tab.
In your webpage, use window.location.hash to return the params. In the above example it will return #someinfo.