basically I want to stop the lockscreen from kicking in on a windows 10 app while my app is running on windows phone 7+ it was PhoneApplicationService.Current.UserIdleDetectionMode now I cant seem to find a replacement.
You should use the DisplayRequest class.
When a display request is activated, the device's display remains on while the app is visible. When the user moves the app out of the foreground, the system deactivates the app's display requests and reactivates them when the app returns to the foreground.
Ref:
DisplayRequest class
Sample code:
var dr = new DisplayRequest();
dr.RequestActive();
// ...
dr.RequestRelease();
Related
I have created a simple app that uses google oauth2 authentication. I have used the open() method to load the google auth page on the default browser instead of creating a secondary window on an app itself.
And when google auth successfully authorized, I call the following code on the main process
ipcMain.on('signin-successful', (event, arg) => {
mainWindow.loadFile('home.html')
mainWindow.show();
})
In mac OS, it is working perfectly fine. After login success, the electron app comes in the foreground as focused. But on Windows OS app does not come in the foreground; instead, the app icon at the start bar (windows start bar) keeps blinking. Is there any way to bring the app to the foreground as in mac OS?
Note: I have tried other functions like restore() and focus(), but none of them worked for me.
I found it to be a weird behavior of windows 10 (reference)
And a minimal solution to show browserWindow to foreground is:
function BringMainWindowToForeground() {
mainWindow.setAlwaysOnTop(true);
mainWindow.setAlwaysOnTop(false);
mainWindow.show();
}
I'm building an app using Electron. And I really want to recreate what UWP apps can do. UWP apps can get shown on top of the lock screen. How can I achieve that using Electron/NodeJS?
I tried to do this, but it didn't work:
const mainWindow = electron.remote.getCurrentWindow();
if(isWindows10){
try{
lockSystem();
}catch{
//return an error
}
}
mainWindow.restore();
mainWindow.focus();
mainWindow.setKiosk(true);
And if you're wondering about the fact that UWP apps can get rendered on top of the lock screen, yes they indeed can get rendered on top of the lock screen. You can try to take an exam on exam.net on a windows 10 device, and choose the restricted mode. This will result in chrome opening a pop-up window that asks you to run a UWP app that will lock the device and get rendered on top of the lock screen.
https://www.electronjs.org/docs/tutorial/windows-store-guide - This won't help, as the app doesn't gain access to UWP APIs/features.
EDIT: https://github.com/felixrieseberg/electron-uwp-background - Never mind, it is possible to access those features. But I can't figure out how to do it. Any idea?
I'm developing windows 10 UWP app. I need to collapse system tray only for Windows 10 Mobile app.
Finally I got answer
var statusbar = "Windows.UI.ViewManagement.StatusBar";
if (ApiInformation.IsTypePresent(statusbar))
{
//await Windows.UI.ViewManagement.StatusBar.GetForCurrentView().ShowAsync();
await Windows.UI.ViewManagement.StatusBar.GetForCurrentView().HideAsync();
}
Note: Don't forget to add windows phone extention before using above code
Fore more Info:
https://msdn.microsoft.com/en-us/library/windows/apps/Dn609832.aspx
I find the way that can help you! u should use this code in the public MainPage() class
ApplicationView.GetForCurrentView().TryEnterFullScreenMode();
this code hides the status bar and make ur app full screen in phone
I am a 'Chrome for Business and Education' admin for a fleet of chromebooks which I have configured to run in Single App Kiosk mode. The kiosk app in question is really simple. All I did was take the example code from this page that uses the 'webview tag' (without controls, as we need all the whole screen for the app in question) and change the URL. The app has installed perfectly in all managed devices.
The problem now is that there are times when we want to be able to exit the kiosk app and return to the chromebook login screen. Right now the only way of doing this is to shut the machine down, start it and exit from the kiosk app boot screen by pressing Ctrl+Alt+S. The whole process takes 30 seconds plus per machine (the fleet contains 50). So we really need to be able to just quit out of the kiosk app and go back to the login screen (which would take about 5 seconds or less).
Now, I could just add a quit button to the screen (as per the second example app with navigation controls from the page referenced above) but this means we lose screen space for the app. The preferred solution is to close the app with keystrokes (e.g. Ctrl+Shift+L). But how do you do this in this context? I have tried adding conventional onkeydown javascript to the page containing the webview tag and this seems to be ignored. I have also tried using the 'chrome commands API', and whilst I can see that the shortcut had been registered against the extension (by clicking 'Keyboard shortcuts' on the chrome://extensions tab) it has no effect. The kiosk app window remains stubbornly open.
Does anyone know if this is possible and if so how?
Cheers,
Miles
In your manifest.json file add this entry to create the command for the app.
"commands": {
"exit-app": {
"suggested_key": {
"default": "Ctrl+Shift+L"
},
"description": "Exit the app"
}
}
Then you need to add code to your background script file to listen for the command. This code will close all windows in the app when it receives the exit-app command you created in the manifest.
chrome.commands.onCommand.addListener(function(command) {
switch(command) {
case 'exit-app':
exitApp();
break;
}
});
function exitApp() {
chrome.app.window.getAll().forEach(function(win) {
win.close();
});
}
Note that the key combination is only suggested, and might be ignored if another app or Chrome keyboard shortcut already uses that combination. You do still need to go to the Keyboard shortcuts link on the chrome://extensions page and verify that the key combination has actually been set for your app.
I am creating an iPhone app in which I am providing a call feature with the help of which a user can call place a call on a specified number. I am able achieve the above feature via open URL.
Now after completion of the call I want to resume the execution of app automatically. Although a user can make a fast app switch in iOS 4.0. but I want this to be done automatically.
I have seen the same behavior in "TomTom" app but I am not sure how this app has achieved it.
Thanks
Sandy
Apple does not allow you to resume an app after a phone call. What you can however try doing is using a local notification.
After calling the 'call' url handler you will need to start a background task and monitor for a call state change:
CTCallCenter *c=[[CTCallCenter alloc] init];
c.callEventHandler=^(CTCall* call){
if(call.callState == CTCallStateDisconnected) {
// do stuff here
}
}
When you get a call state change, create a local notification to alert the user to resume the app. If the user taps on "view" your application will then come to the foreground. Obviously if the call is longer than 10 minutes this won't work as Apple only allows 10 minutes to background tasks.