locked
windows 8 device permission dialog hidden when accessing the microphone RRS feed

  • Question

  • Hi.  My app has requested access to the microphone via the manifest file for a simple javascript metro app.  When the app starts the windows 8 green dialog that asks if it's ok if the app access the microphone is hidden behind the app.  This dialog appears for a split second when shutting down the app from inside Visual Studio (stop debugging).   Some devs can get to this dialog with a seemingly random sequence of steps that include task switching via ALT+TAB, running the app from outside Visual Studio (via clicking on the main win8 metro tile).  Some devs just can't get the dialog to be sent into the foreground.  Spy++ doesn't seem to have a switch-to task, task manager "switch to" doesn't work.  Also tried sysinternals process explorer and it's version of switch to via the wwahost.exe app.

    thanks.

    Tuesday, November 15, 2011 9:38 PM

Answers

All replies

  • Hi J,

    If you add the WebCam to the manifest does the problem also reproduce?  Is this on all of your machines you have tried?

    -Jeff


    Jeff Sanders (MSFT)
    Wednesday, November 16, 2011 2:38 PM
    Moderator
  • Adding the webcam to the manifest does not help.  All machines tried, current tally: 3 Win8 machines running inside VMWare 4 Fusion on Mac and 1 PC running Win8 natively.

    We eventually see the dialog, but it takes a lot of ALT+TAB and seemingly random sequence of mouse clicks and such to see the dialog.

    thanks.

    -Justin


    Justin
    Wednesday, November 16, 2011 9:22 PM
  • Hi Justin,

    It may have something to do with where in the sequence of your app you are initializing the MediaCapture. I tried a couple of times to repro this and as soon as I initialize and start recording, I am prompted.  I tried from the debugger and outside the debugger.

    If you click on my name you can send me an email with a simple repro of the issue.

    -Jeff


    Jeff Sanders (MSFT)
    Wednesday, November 16, 2011 9:27 PM
    Moderator
  • yeah, I am working on a simpler test to enable audio at a higher level in the code.  The code that initializes the audio is in a win32 static library buried somewhere, maybe that is the problem.
    Justin
    Wednesday, November 16, 2011 10:10 PM
  • I wrote a simple app from scratch that accesses the mic using the code from this example: http://msdn.microsoft.com/en-us/library/windows/apps/dd370800(v=VS.85).aspx.  My initial test of this app did show the pop-up dialog.

    Is there a way in the OS to get a list of all apps with their given permissions so that I can selectively add/remove certain permissions.  Things I would like to be able to do:

    * For testing, run this app and click on "allow".  Selectively remove this action and re-run my app to re-test that the pop-up dialog is shown.

    * Click on "block", verify my app doesn't crash or have other odd behavior after being blocked, then remove this block and re-test selecting "allow" for the desired permissions.

    thanks.

    -justin


    Justin
    Thursday, November 17, 2011 4:12 PM
  • Hey Justin,

    OK, my suspicion is that in the problem code, the audio device is being accessed before the application DOM is built.  You can ensure this does not happen by initializing things in the "WinJS.Application.onmainwindowactivated" function.

    You cannot list all of the permissions together.

    As far as testing the allow prompt, I used this technique (I could not find a cool supported way to do this other than this):

    Find you application ID in the manifest by right clicking on your manifest and Open with the Text editor.  Find the Identity Name=<appid>

    You deployed package will be here: C:\Users\<userid>\AppxLayouts\<appid and goop>.  Delete the appid directory.

    Re-deploy your app from VS.

    PS:  You know you can unblock from the Settings charm right?

     

     -Jeff

     


    Jeff Sanders (MSFT)
    Thursday, November 17, 2011 4:21 PM
    Moderator
  • The code that makes audio calls isn't executed until the user clicks on a button so I don't think that the problem is initialization timing.  

    My attempt to fix this by calling audio related API's directly as opposed to calling them through my original static lib have failed.  My basic javascript app and WinRTComponentDLL project that uses the code from http://msdn.microsoft.com/en-us/library/windows/apps/dd370800(v=VS.85).aspx, exhibits the same problem.

    Could this be due to the fact that the app is built as a desktop app and not a pure metro app?  I wasn't able to find the audio api's that are strictly for metro apps.  The docs on msdn show which audio apis are available in metro apps, but those docs eventually point to the example code I linked to above.  This example code uses mmdeviceapi.h which is guarded by a #ifdef and only allowed on apps that are desktop or desktop/metro apps. So I do the following to get the above sample building (this is really a separate question on its own, how to use audio in a pure metro only app): 

    #define WINAPI_FAMILY WINAPI_FAMILY_DESKTOP_APP
    #include "Mmdeviceapi.h"

    As for a workaround, I finally found that if I move the mouse all the way to the left side of the screen and left-click 3 or 4 times the screen will switch between apps and the permission dialog will eventually show up.


    Justin
    Thursday, November 17, 2011 7:25 PM
  • Hi Justin,

    You fooled me, I thought you were asking a Metro Style app question since that is what the forum is :-).

    So this is a desktop application (Could this be due to the fact that the app is built as a desktop app and not a pure metro app?)?  I did not think you got consent dialogs for Desktop applications.

    -Jeff


    Jeff Sanders (MSFT)
    Thursday, November 17, 2011 8:10 PM
    Moderator
  • So where should I ask the question?  How do I get help with this?
    Justin
    Thursday, November 17, 2011 9:04 PM
  • I will see what I can find out!
    Jeff Sanders (MSFT)
    Thursday, November 17, 2011 9:20 PM
    Moderator
  • Is this two different problems?  IN the beginning you said you were running jscript in WWAhost.
    Jeff Sanders (MSFT)
    Thursday, November 17, 2011 9:21 PM
    Moderator
  • The main problem is the hidden permission dialog.  My setup is a vanilla WinrtComponentDLL project with a basic javascript Metro App using Visual Studio 11 Preview.  When adding calls to certain audio API functions to access the mic, the dialog pops up but doesn't come to the foreground.  The audio API's I am using are apparently not valid for metro-only apps, but seems irrelevant to the popup dialog question.  Sample audio code is taken from http://msdn.microsoft.com/en-us/library/windows/apps/dd370800(v=VS.85).aspx.

    Thanks.


    Justin
    Thursday, November 17, 2011 9:33 PM
  • Thanks for the info Justin!  I have filed a bug on this problem and the dev team is investigating.
    Jeff Sanders (MSFT)
    Wednesday, November 30, 2011 2:24 PM
    Moderator
  • We got the same issue. any updates on this is highly appreciated.
    WHQL fans.
    Friday, January 6, 2012 7:14 AM