Show apps on top of the lock screen - node.js

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?

Related

history.go(-1) cannot work in IOS14 Beta2 App

My web app is working in a WebView of an IOS native application. There is a button on the top-left side of the page, and it will go back to the previous page after the button is clicked. So far so good, but recently many customers have upgraded their IOS to 14 Beta2 and now the back button doesn't work as expected.
I use the history.go(-1) to go back, but if the session history length is 2, it will execute the history.go(-1), but the page will not go back. The url also doesn't change. If the user continue to open new page, then it works again.
Does anyone have ideas of whats going on with it?
I meet the same problem. You can use setTimeout delay for a while when you use history.push,like this
setTimeout(() => {
history.push('xxx');
}, 100);

Corona net::ERR_CACHE_MISS comes when loading an external url in Corona

I am using Corona to make an app. I have implemented following code to open a website/a page inside my app view instead of browser:
function openLink(event)
if(event.phase == "ended")then
print("btn clicked")
local webView = native.newWebView( display.contentCenterX, display.contentCenterY, 320, 480 )
webView:request( "http://www.coronalabs.com/" )
local text1 = display.newText("",100,100,native.systemFontBold,20)
text1.text = "native should come"
end
end
btn:addEventListener("touch", openLink)
Its giving me following error on device when button is tapped:
net::ERR_CACHE_MISS
Please help me out with this. Also, I have few questions regarding feasibility of this function.
Can I access full interactivity of website inside app view? i.e. scroll through pages, open other pages, navigate to other elements of website etc.
If I can't access complete website with ease, is there any possibility that I can open multiple pages one after another of same website on click of various buttons created by me inside app?
Any help is greatly appreciated.
The ERR_CACHE_MISS error comes from Chrome. To avoid it, check the following:
Make sure you can get to the URL from a browser on the mobile
device to ensure the issue isn't with your Internet connection.
Make sure that your build.settings file in your Corona app allows for Internet
permissions. For Android, this means including the following in build.settings:
-- Android permissions
androidPermissions = {
"android.permission.INTERNET",
},

Logging out of managed chromebook running in single app kiosk mode

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.

how to integrate vserv ads sdk to windows phone 8 application

I have developed a windows phone 8 application. Now I want to display vserv ads to my application.
I have added the sdk to my application and also applied code to show ads:
public MainPage()
{
InitializeComponent();
VservAdControl VMB = VservAdControl.Instance;
VMB.DisplayAd(zoneID, LayoutRoot);
VMB.VservAdClosed += new EventHandler(VACCallback_OnVservAdClosing);
VMB.VservAdNoFill += new EventHandler(VACCallback_OnVservAdNoFill);
}
void VACCallback_OnVservAdClosing(object sender, EventArgs e)
{
MessageBox.Show("Ad close by user.");
}
void VACCallback_OnVservAdNoFill(object sender, EventArgs e)
{
if (adGrid != null)
adGrid.Visibility = Visibility.Collapsed;
}
But after closing the ad the application page goes blank, all content, application bar automatically goes blank. After using back arrow that quits my application, i try to relaunch my application but application stuck at the splash screen on the emulator.
Wrap ad control inside a grid. Ad control could have manipulated the grid
I encountered the same issue and they have updated their SDK several times. If you provide the stacktrace they will provide you a fix.
Apart from what you have seen, there are other issues with the SDK. I integrated it few weeks back. So issues could have been resolved after that.
Memory leak. Click the ad or navigate back and forth - you will see the memory ever growing. This is because of events not being detached (withing SDK). I was consistently able to see my app crash in 512 MB emulator when banner ad is loaded (after 4 - 5 times). They could have used weak listeners. You might need to tweak a lot to overcome this issue (In multi page app)
RequestAdCallback throws null pointer exception sometimes crashing
the app. When people use app, they will navigate fast - forcing the
webbrowser to unload. All callbacks should be null pointer exception
free. Make sure that you handle unhandled exception globally otherwise app will not pass certification
It reads WMAppManifest.xml as text not as XML. So I had App element commented in first line before the actual one. It picked title from commented XML element
Application bar is manipulated in many events in the SDK. So you have to make sure that app bar is built dynamically. Test all navigation paths.
SDK assumes user will click the left arrow button which fires ad closing event. Try pressing phone back button instead. The app bar still disappears
SDK documentation requests app to demand ID_CAP_REMOVABLE_STORAGE capability. I don't see a reason to request this capability but I didn't add this
I have emailed them all these details. May be their latest SDK could have resolved these issues. But please do thorough testing after integration.
Add a function to load applicationbar using code
private void BuildLocalizedApplicationBar()
{
// Set the page's ApplicationBar to a new instance of ApplicationBar.
ApplicationBar = new ApplicationBar();
ApplicationBar.Mode = ApplicationBarMode.Default;
ApplicationBar.Opacity = 1.0;
ApplicationBar.IsVisible = true;
ApplicationBar.IsMenuEnabled = false;
// Create a new button and set the text value to the localized string from AppResources.
ApplicationBarIconButton button1 = new ApplicationBarIconButton();
button1.IconUri = new Uri("/Images/sms.png", UriKind.Relative);
button1.Text = "sms";
ApplicationBar.Buttons.Add(button1);
}
and then in VACCallback_OnVservAdClosing event handler call the function
BuildLocalizedApplicationBar()
Please check the following link,
where to add application id and adUnitiD while integrating vserv ads sdk to windows phone 8 application, which is related to your question.

Show alert about internet connectivity before launching the application (Monotouch)

I am developing an app that requires an internet connection, so I want to check the availability before launch.
If internet connection it is not available, show an alert to the user and go back to Home instead of trying to launch the app.
So I used the Reachability class, that was recommended here (http://stackoverflow.com/questions/1961341/check-for-internet-access-with-monotouch) to check the internet connection.
So far so good. But if I place this check in my Main.cs, it performs the check, but will not display the alert.
if(!Reachability.IsHostReachable("http://google.com")) {
Debug.WriteLine("OFFLINE");
UIAlertView alert = new UIAlertView("Offline","Voor deze app is een internetverbinding vereist.",null,"OK",null);
alert.Show();
}
else{
MPFramework.Application app = new MPFramework.Application();
UIApplication.Main (args, null, "AppDelegate");
}
If I place this check in AppDelegate.cs it performs the check, displays the alert, but keeps a black screen instead of returning to Home.
So where do I place my code in order to check before launching the app, and displaying an alert?
You're looking at this a bit wrong:
Apple doesn't approve of apps that kill/close themselves (see this: https://stackoverflow.com/a/356342/183422). If the user wants to close your app, he should do it himself.
You need the main loop running to show any UI - and that main loop is started when you call UIApplication.Main (which is why you have to do the check in AppDelegate.cs and show the corresponding alert there instead of in your Main method).
So, putting these things together, I think you should show a blank/splash screen, check for reachability and if there is none then show the alert (and if the user dismisses the alert, maybe check again).

Resources