Is it possible to query the camera privacy settings for windows 10? - windows-10-desktop

It appears that the Windows 10 April update has changed access permissions for devices such as the camera and microphone, restricting all by default to none.
https://privacy.microsoft.com/en-us/windows-10-camera-and-privacy
I am using a Realsense 435 camera and want to notify the user, when he needs to adjust the privacy settings - something like "Go to Privacy Settings. Select the tab 'Camera' and turn on 'Allow apps to access your camera'".
Is there an API to detect the current state of the camera privacy settings?

Is there an API to detect the current state of the camera privacy settings?
There's no built-in APIs for you to detect the state of camera privacy settings.
But we could think about this question from another hand, if the camera settings turn off. When you initialize the camera object, it will throw exception in your code.
For example: Camera Resolution Line86 If you catch the exception, you could launch the privacy settings page for the camera by using await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings:privacy-webcam"));
public async Task InitializeCameraAsync()
{
MediaCapture = new MediaCapture();
MediaCapture.Failed += MediaCapture_Failed;
try
{
await MediaCapture.InitializeAsync();
_previewControl.Source = MediaCapture;
await MediaCapture.StartPreviewAsync();
IsPreviewing = true;
}
catch (UnauthorizedAccessException)
{
// This can happen if access to the camera has been revoked.
MainPage.Current.NotifyUser("The app was denied access to the camera", NotifyType.ErrorMessage);
await Windows.System.Launcher.LaunchUriAsync(new Uri("ms-settings:privacy-webcam"));
await CleanupCameraAsync();
}
}

I was looking for the same thing, except for the microphone, and after changing the settings and doing a registry diff, I found that changing that setting changes the Value between Allow and Deny at
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\webcam\NonPackaged
For camera,
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\CapabilityAccessManager\ConsentStore\microphone\NonPackaged
For microphone.
The NonPackaged keys are for the desktop apps. You can toggle (or query) all UWP access at the webcam key, and each UWP app seperately at their subkeys.

Related

Button is not showing in Google Nest devices but showing properly in Mobile Assistant

I am using google actions for one of our clients. We are using Button to navigate the user to a specific URL but Button is not showing in the Nest devices, but it is showing fine in Mobile Assistant devices.
Anyway, where we can enable the same?
Also if there is no option, what is the way to identify if the user logged in the device has button functionality enabled?
Buttons that link to a webpage are not available on smart displays. In the platform different devices have certain limitations. As such, the device running the action sends capabilities that define what is possible. You will need to check for the WEB_LINK capability.
In the Node.js library this would be done as such:
app.handle('handle-name', conv => {
const supportsWebLink = conv.device.capabilities.includes('WEB_LINK')
if (!supportsWebLink) {
// Behavior for Nest Hub and other devices
}
})
I see you have the dialogflow-es tag rather than actions-builder, so to do it in Dialogflow:
app.intent('intent-name', conv => {
const supportsWebLink = conv.device.capabilities.includes('WEB_LINK')
if (!supportsWebLink) {
// Behavior for Nest Hub and other devices
}
})

Show apps on top of the lock screen

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?

Using WebRTC getUserMedia with UWP WebView

I've created a basic UWP application with a WebView. I'm navigating to this URL: https://webrtc.github.io/samples/src/content/getusermedia/gum/ to test the use of getUserMedia().
The error I get is: getUserMedia error: NotFoundError
Does anyone know if this should be possible, and if I'm therefore doing something wrong? Anyone using getUserMedia within a UWP WebView?
Thanks for any guidance.
getUserMedia error: NotFoundError
This error will occurre when the user denies permission, or media is not available.
In an UWP app, when you want to access Media capture, you will need to open the manifest file of your project, go to the Capabilities label and select the Webcam capability to enable the Camera device for your app.
This will solve the problem, but for your case, I think you may also need to enable the Microphone capability in the same way.
In addition to the accepted answer, I needed to add this handler to the webview to allow permission:
webView.PermissionRequested += WebView_PermissionRequested;
...
private void WebView_PermissionRequested(WebView sender,
WebViewPermissionRequestedEventArgs args)
{
args.PermissionRequest.Allow();
}

Using both activeTab and serial permissions

I am trying to use a hardware serial device to change what displays on a webpage in Chrome. I'm making a Chrome extension to do so, however it seems as if I cannot use both the activeTab and serial permissions at the same time. The activeTab permission requires the app to not be a packaged app, and the serial permission requires the app to be packaged.
How can I get around this if possible?
I am using the page redder sample code as the way to change the webpage, however it requires the activeTab permission. Maybe there is a workaround to this? Thanks
The only way I can think of is to create one Chrome Extension and one Chrome App that communicates to each other: https://developer.chrome.com/extensions/messaging#external
// The ID of the extension we want to talk to.
var laserExtensionId = "abcdefghijklmnoabcdefhijklmnoabc";
// Make a simple request:
chrome.runtime.sendMessage(laserExtensionId, {getTargetData: true},
function(response) {
if (targetInRange(response.targetData))
chrome.runtime.sendMessage(laserExtensionId, {activateLasers: true});
});
// Start a long-running conversation:
var port = chrome.runtime.connect(laserExtensionId);
port.postMessage(...);
An alternative is to make a Native Messaging host that communicates with the device and with your extension.
From architectural point of view this makes more sense, but limits your deployment options, as the host program can't be bundled with the extension in the Web Store.

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.

Resources