ionic 3 disable all hardware buttons prevent from exit app - ionic-framework

What I need to do is to disable the hardware buttons of Android (using Ionic 3), in order to prevent the app to close, or go back to Android main page, or exit the app in any ways.
I want to disable the back, the home, the right button and if it is possible the button which closes the device. Is it possible?
First of all I can't find the official documentation of Ionic "Platform" with its options and secondly I want to achieve the above.
Any help or instructions, it will be appreciated.

Have a look at Kiosk mode https://developer.android.com/work/dpc/dedicated-devices.
Cordova has a Kiosk mode plugin as well https://github.com/hkalina/cordova-plugin-kiosk.

Related

Ionic capacitor hybrid mobile application

I want to create a hybrid mobile app using ionic capacitor. When user logs in the app should open the main angular app in a hidden webview to initialize the angular app. The webview should be hidden for this time. After this when a user clicks on any links in mobile app, it should open in the webview and this time the webview should be displayed. The webview should open in the app container and not in the browser window (like InApp browser). Please help me if anybody have explored this kind of solutions.
My existing app is built using Xamarin and its built on the above concept.
I have tried the InApp browser but it does not give a good impression to the end user expecting a complete mobile app.
What you want to do is more or less possible if I've understood you well. I've done it in my job. We have a ionic app, but then there are some native screens developed natively for Android (with Java) and iOS (with Swift). With ionic you can call native code from Javascript. For that you need to make your own local Capacitor plugin: https://capacitorjs.com/docs/plugins/creating-plugins
In a plugin, the ionic Javascript function will trigger a native function (Java/Kotlin for Android - Swift/ObjectiveC for iOS). Once there, you can freely create native screens (Android = Activity, iOS = Storyboard/Controller) and then launch your native screens in the app. In our project most of the app is ionic, but we developed our own native screens such as a PDF Viewer, a Web browser, a QR scanner, etc.
But an app is not like a website, an app is a stack of screens. Which means that everytime you access a new screen, it's added to the top of the stack and the user can go back to the previous one. So, ionic will launch first. Inmediately after starting the app (or whenever you want) you can move the user to a native (android/ios) screen. However, if the user presses the native android back button, he will come back to ionic. If you want to prevent that, you need to code that behavior yourself (google android prevent back button). Likewise, you "can't" make the user go from the native screen to ionic, you can bring him back to ionic by navigating back programmatically.
Perhaps you can also change the launch activity to use a different one, and then later launch the ionic activity with native code. But I haven't done this myself and it could break ionic, so I can't advice you through this path.
I hope my answer helps, but I'm not sure I understood what you want to accomplish.

Detect window closing action flutter desktop

I am working on flutter desktop application and want to show alert dialog before closing window. Could not get any information about detecting window closing action.
Can anyone tell me how to do this. Thankx.
You can do it using the existing flutter_window_close package. Check out the example here.
This plugin lets your Flutter app a chance to confirm if the user wants to close your app. It works on desktop platforms including Windows, macOS and Linux.
Try to explore as well bitsdojo_window.

Let Ionic2 browser apply windows(wp) theme

I am using Ionic v2(currectly is 2.0.0-beta.25).
After created a Ionic v2 project, and run the
ionic serve
command, Ionic will apply the iOS theme in the browser by default. Since Ionic announced it supported the windows platform, i am planning to use ionic v2 to create an application, so i wish i can preview as windows/wp theme in my browser. The document said that add ?ionicplatform=android to the URL can change how Ionic sees which platform i am on, it works and changed the theme as android. Then i tried ?ionicplatform=wp and also ?ionicplatform=windows . it doesn't work.
I also followed this document to add class="wp" , it still doesn't work. i also found Ionic Lab, this application even don't have a windows phone option.
The offical document have a live perview on the right side of the v2 components document page. so i think maybe there is some way to make the perview in browser to apply the windows/wp theme. I've google it but can't find any answer.
I also tryed edit my UserAgent as Lumia phone but it still doesn't works.
So, if i want the ionic serve browser perview apply windows/wp theme, what should i do?
Thanks
You can do this using chrome. When project are running make inspect and select ctrl+shift+m for change to device mode and choice your phone. If windows phone are not in that list, click edit in dropdown and there you have at least one Windows Phone. :)

Ionic served as web app

I have an Ionic app which I currently serve as a web app by doing ionic serve
I have few questions about it:
By default in the served web app, it takes the iOS layout, can it be changed to the android layout instead? How?
In the android version of y ionic app when I do ionic serve --lab, some of the bottom part of the content is somehow cut off (I can not scroll till the end), however it looks perfect in iOS version. Why does this happen and how can I fix it?
When I try to make an APK out of it as mentioned in the following link http://ionicframework.com/docs/guide/publishing.html , I get a blank app on my android device. What could be the reason?
ionic serve --platform android
Are you taking in account that iOS scroll "stretches"? I mean, even when the scroll is all way down, you still can pull the content up. Maybe your content is indeed hidden (specially if you are using a footer bar. Actually, if you are using a footer bar, try to add a margin-bottom for your content equal your footer bar height.).
Have you checked if this happens when you run ionic run android? If this command works, try to run cordova prepare android before following the publishing procedure. If the command does not work, open chrome://inspect on your computer's chrome browser (with the device connected to your computer and running your app) and debug it to check if your code is being packed with the apk and/or the app is yielding some error messages.

Ionic serve --lab doesn't support pull to refresh

when I use ionic serve --lab, the browser won't let me use the pull-to-refresh gesture.
When I click and drag my mouse the app doesn't react to it. I had it working this morning but then I shut down the ionic serve and after it it didn't work anymore. Code to the pull-to-refresh isn't changed.
When I use it on a device or emulator it does work.
Does anybody have a clue?
I'm testing on Chrome version 43.0.2357.124 m