Windows Phone 8 AdControl AdException? - windows-phone-8

I've been testing a new Windows Phone 8 app for the last couple of weeks. I haven't yet published it to the Store yet, so I've only tested my AdControls with test values (i.e. "test_client" and "Image480_80").
I noticed the other day as soon as I launch my app, I see the AdControl for a second, and then it disappears. No error is thrown on the app's interface, but in the Output window I can see the following exception:
An exception of type 'Microsoft.Advertising.Shared.AdException'
occurred in Microsoft.Advertising.Mobile.DLL and wasn't handled before
a managed/native boundary
Here is the stack trace:
at
Microsoft.Advertising.Shared.AdvertisementFactory.CreateFromResponse(String
response, AdDownloadCompleteCallback adDownloadCompleteCallback)\r\n
at Microsoft.Advertising.Shared.AdPlacement.CreateAdvertisement(Byte[]
bytes)\r\n at
Microsoft.Advertising.Shared.AdPlacement.AdRequestComplete(IWebRequestWrapper
request)
Here is my code which adds the AdControl to my Grid:
AdControl adControl = new AdControl("test_client", "Image480_80", true);
adControl.Width = 480;
adControl.Height = 80;
adControl.ErrorOccurred += AdUnit_ErrorOccurred;
MyGrid.Children.Add(adControl);
Grid.SetRow(adControl, 4);
Grid.SetColumn(adControl, 4);
This was working fine up until a few days ago, so I'm not sure if the code needs to change but is there anything else I can check? I saw an article that said to make sure I've got the required capabilities in my WMAppManifest.xml file. Here's what I've got currently:
<Capabilities>
<Capability Name="ID_CAP_NETWORKING" />
<Capability Name="ID_CAP_MEDIALIB_AUDIO" />
<Capability Name="ID_CAP_MEDIALIB_PLAYBACK" />
<Capability Name="ID_CAP_SENSORS" />
<Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
<Capability Name="ID_CAP_IDENTITY_USER" />
<Capability Name="ID_CAP_MEDIALIB_PHOTO" />
<Capability Name="ID_CAP_PHONEDIALER" />
</Capabilities>
Does anyone know of anything else I can check - or know what I may be doing wrong? I'm really stumped. If there's anything else I can post from my Exception object (in addition to the stack trace above) please let me know, although I didn't see anything that hinted at a possible problem.
UPDATE:
I can also confirm that using my actual ApplicationID and AdUnitID in place of the test values that the exact same thing happens. Has anyone else experience this?
UPDATE 2:
I've been emailing back and forth with PubCenter Support, and they've apparently been able to replicate the problem because the analyst helping me (Support Analyst II) has now engaged the engineering team to look into the problem. There is no ETA on a resolution but they said using my actual ApplicationID and AdUnitID should work when testing on an actual device (although I already confirmed it does not work in my emulator).
UPDATE 3:
I'm still waiting to hear back from PubCenter Support, but I have now confirmed that Ads DO WORK successfully if I use the real ApplicationID and AdUnitID. Previously, I thought this didn't work, but it appears it only doesn't work when running in the emulator - on the device itself, they work fine. So it is only test ads that don't seem to work, and since that's the case, I'm not too worried about it.
UPDATE 4 (SOLUTION):
OK - After weeks of back and forth with PubCenter Support I finally have a solution, although I'm pretty sure it was an issue on their end that is now resolved. I had created a very simple test solution which demonstrated my problem that I sent to them and they finally concluded that this:
AdControl adControl = new AdControl("Test_client", "Image480_80", true);
Needed to be this:
AdControl adControl = new AdControl("test_client", "Image480_80", true);

To find out more specific error information, you can inspect the AdErrorEventArgs passed to the AdControl.ErrorOccurred event you've already registered. If it's still not clear from that information, please add the error/error code to your question.
The reason I've seen this exception show up is that there are no ads to display (ie you've specified a too narrow selection of ads to display and there are no matching ones available), but that should in that case be clear when you view the error.

Apparently, this:
AdControl adControl = new AdControl("Test_client", "Image480_80", true);
Needed to be this (note the lowercase "t" in test_client):
AdControl adControl = new AdControl("test_client", "Image480_80", true);
Who would have thought?

I have the same problem. The ads in my WP7.5 app work in both the emulator and the phone. When I upgrade my app to WP8 the ads stop working. So, I added a second ad provider control to my app and made it so that if MS ad control gets an error it hides and displays the 2nd ad from a different company.

Related

Add notification to Windows notification center without displaying it on screen

I am building an Electron app featuring a custom Notification feature where html5 divs appear and disappear as needed on a frameless, transparent, always-on-top window.
It works great, but: I still like the Windows notification center itself, and would like to have the option to see the past notifications there, without actually displaying them on screen with the HTML5 api.
I have tried:
Looking into the HTML5 api for an option to not show a notification, or to .hide() it right away: no luck. The only method that comes close is .close(), and it removes the notification from the center as well.
Looking into packages like node-notifier, but none of the used notification dependencies offer a way to completely hide a notification.
While I mentioned Node, I will also accept any lower-level API/binding that would allow me to do this.
Thanks in advance.
With the help of #treckstar in comments, I have found a way to do what I wanted using:
NodeRT
The ToastNotification.SuppressPopup attribute
Despite a handful of troubles building NodeRT and using electron-rebuild, here's a working PoC:
const { XmlDocument } = require('#nodert-win10-rs4/windows.data.xml.dom');
const {
ToastNotification,
ToastNotificationManager
} = require('#nodert-win10-rs4/windows.ui.notifications');
const localImage = path.join(__dirname, 'icon.png');
const template = `
<toast launch="app-defined-string">
<visual>
<binding template="ToastGeneric">
<image id="1" placement="appLogoOverride" hint-crop="circle" src="${localImage}"/>
</binding>
</visual>
</toast>
`;
const xml = new XmlDocument();
xml.loadXml(template);
const toast = new ToastNotification(xml);
const notifier = ToastNotificationManager.createToastNotifier("com.myapp.testnotif");
toast.suppressPopup = true;
notifier.show(toast);
May this help whoever comes across the same highly-specific problem.
In addition to what #MadWard shows in the PoC, the suppressPopup key is really the main player of the solution.
As I was going through tons of examples and electron code I kept hitting roadblocks due to random SDK versions and libraries of things I had installed. For example, the package electron-windows-notifications, which uses NodeRT was failing to load my preload.js because the Windows 10 SDK I had installed (build 15063) needed nodert-win10-cu instead of what was being used in most solutions by default nodert-wind10-au.
SDK
Known As
Windows Version
npm Scope
Windows 10, Build 17134
April 2018 Update (Redstone 4)
1803
npmjs.com/org/nodert-win10-rs4
Windows 10, Build 16299
Fall Creators Update (Redstone 3)
1709
npmjs.com/org/nodert-win10-rs3
Windows 10, Build 15063
Creators Update (Redstone 2)
1703
npmjs.com/org/nodert-win10-cu
Windows 10, Build 14393
Anniversary Update (Redstone 1)
1607
npmjs.com/org/nodert-win10-au
Windows 10, Build 10586
Threshold 2
1511
npmjs.com/~nodert-win10
EDIT: I forgot to include the more specific steps I took getting electron-windows-notifications dependency files on this GitHub issue here. Basically everything from Python, broken node-gyp, and missing .winmd files.
Lastly Electron 14+ and NodeRT have an issue where you will need to make sure to have app.allowRendererProcessReuse = false and like the readme file says, to make sure this is running in the main.js file.
Hopefully this helps someone along the way, as I had never used Electron before until today and had learned a ton thanks to other peoples help.

Winphone 8.1, Winphone 10 and Moga pro connection

I'm making a game support MogaPro run on both WP10 and WP8.
Here is the Capabilities code on packet manifest
<Capabilities>
<Capability Name="internetClientServer" />
<DeviceCapability Name="proximity" />
</Capabilities>
Create gamepad object:
if (!g_GamePad)
{
try
{
g_GamePad = ref new Moga::Windows::Phone::ControllerManager();
g_GamePad->Connect();
}
catch (Platform::Exception^ e)
{
return false;
}
if (!g_GamePad)
return false;
}
And code check connection:
if ((g_GamePad) && ((Moga::Windows::Phone::ControllerManager^)g_GamePad)->GetState(Moga::Windows::Phone::ControllerState::Connection) == Moga::Windows::Phone::ControllerResult::Connected){//code callback}
The problem is when I run on WP10 device, a system popup appear ask user want to use moga pro on this app or not. If I chose Yes, game run perfect. If I chose No, the Moga and Game never connect until I Uninstall and reinstall app.
But in WP8.1 I doesn't see any confirm popup and can not connect moga pro and game. Always assert at code check connection.
What is different between WP10 and WP8.1, and how I connect Moga and WP8.1.
Please help,
Thanks.
It looks like some incompatibility between MOGA control and Windows Phones; it's not possible to answer your question without access to the MOGA source code, but issue definitely not in your code.
I recommend you to try my open source library: worked perfectly with MOGA Mobile and should work with MOGA Pro.

EmailManager.ShowComposeNewEmailAsync Exception The parameter is incorrect 'User'

My UWP apps suddenly throw the following exception on Win 10 Mobile Build 10.0.14342.1001. They still work fine in the emulators.
Is anybody experiencing the same problem? Is there a workaround?
Exception thrown: 'System.ArgumentException' in mscorlib.ni.dll
WinRT information: user
Additional information: The parameter is incorrect.
user
To ensure the problem is not related to something specific with the apps email messages I sent the following simple message which causes the same problem.
Dim em As New Windows.ApplicationModel.Email.EmailMessage
em.To.Add(New EmailRecipient("a#b.c"))
em.Subject = "test"
Await EmailManager.ShowComposeNewEmailAsync(em)
Link to test case.
This is a bug in the insider build. No workaround known.
MS was informed about it via feedback and the MS forum.
Got fixed with Windows 10 Mobile Insider Preview Build 14356.
Build 14342 is an insider 'fast' build, meaning it is not production-ready and you are likely to hit errors from time to time. Please file feedback using the Feedback Hub, and wait for the next build. Thanks for being an Insider!

Captured audio buffers are all silent on Windows Phone 8

I'm trying to capture audio using WASAPI. My code is largely based on the ChatterBox VoIP sample app. I'm getting audio buffers, but they are all silent (flagged AUDCLNT_BUFFERFLAGS_SILENT).
I'm using Visual Studio Express 2012 for Windows Phone. Running on the emulator.
I had the exact same problem and managed to reproduce it in the ChatterBox sample app if I set Visual Studio to native debugging and at any point stepped through the code.
Also, closing the App without going through the "Stop" procedure and stopping the AudioClient will require you to restart the emulator/device before being able to capture audio data again.
It nearly drove me nuts before I figured out the before mentioned problems but I finally got it working.
So..
1. Be sure to NOT do native debugging
2. Always call IAudioClient->Stop(); before terminating the App.
3. Make sure you pass the correct parameters to IAudioClient->Initialize();
I've included a piece of code that works 100% of the time for me. I've left out error checking for clarity..
LPCWSTR pwstrDefaultCaptureDeviceId =
GetDefaultAudioCaptureId(AudioDeviceRole::Communications);
HRESULT hr = ActivateAudioInterface(pwstrDefaultCaptureDeviceId,
__uuidof(IAudioClient2), (void**)&m_pAudioClient);
hr = m_pAudioClient->GetMixFormat(&m_pwfx);
m_frameSizeInBytes = (m_pwfx->wBitsPerSample / 8) * m_pwfx->nChannels;
hr = m_pAudioClient->Initialize(AUDCLNT_SHAREMODE_SHARED,
AUDCLNT_STREAMFLAGS_NOPERSIST | AUDCLNT_STREAMFLAGS_EVENTCALLBACK,
latency * 10000, 0, m_pwfx, NULL);
hr = m_pAudioClient->SetEventHandle(m_hCaptureEvent);
hr = m_pAudioClient->GetService(__uuidof(IAudioCaptureClient),
(void**)&m_pCaptureClient);
And that's it.. Before calling this code I've started a worker thread that will listen to m_hCaptureEvent and call IAudioCaptureClient->GetBuffer(); whenever the capture event is triggered.
Of course using Microsoft.XNA.Audio.Microphone works fine to, but it's not always an option to reference the XNA framework.. :)
It was a really annoying problem which waste about 2 complete days of mine.My problem was solved by setting AudioClientProperties.eCatagory to AudioCategory_Communications instead of AudioCategory_Other.
After this long try and error period I am not sure that the problem won't repeat in the future because the API doesn't act very stable and every run may return a different result.
Edit:Yeah my guess was true.Restarting the wp emulator makes the buffer silent again.But changing the AudioClientProperties.eCatagory back to AudioCategory_Other again solve it.I still don't know what is wrong with it and what is the final solution.
Again I encounter the same problem and this time commenting (removing) the
properties.eCategory = AudioCategory_Communications;
solve the problem.
I can add my piece of advice for Windows Phone 8.1.
I made the following experiment.
Open capture device. Buffers are not silent.
Open render device with AudioDeviceRole::Communications. Buffers immediately go silent.
Close render device. Buffers are not silent.
Then I opened capture device with AudioDeviceRole::Communications and capture device works fine all the time.
For Windows 10 capture device works all the time, no matter if you open it with AudioDeviceRole::Communications or not.
I've had the same problem. It seems like you can either use only AudioCategory_Other or create an instance of VoipPhoneCall and use only AudioCategory_Communications.
So the solution in my case was to use AudioCategory_Communications and create an outgoing VoipPhoneCall. You should implement the background agents as in Chatterbox VoIP sample app for the VoipCallCoordinator to work .

How to clear AIR cache for working Facebook logout?

I am developing an AIR application that is supposed to run on desktop and mobile platforms.
For most Facebook functionality, I use the official GraphAPI for Flash, version 1.8.1.
To use the app, the user must login to Facebook, this works easily by first calling FacebookMobile.init(), and if it reports that the user is not logged in, logging in like this:
var webView :StageWebView = new StageWebView();
webView.stage = stage;
webView.viewPort = new Rectangle(0, 0, stage.stageWidth, stage.stageHeight);
FacebookMobile.login(handleLoginResult, stage, new Array(), webView);
All of this works very well, but logging out does not work as expected. Calling
FacebookMobile.logout(handleLogout);
does log out the user from Facebook, it seems, and handleLogout is always passed a true as first parameter. After this logout, when FacebookMobile.init() is called, it also correctly reports the user as not logged in. So I call the login() method from above again.
Then, the WebView opens, but closes itself immediatly, automatically logging in the user that just logged out, without showing any kind of Facebook login screen. But I want to be able to log in another user, by having to type in email and passwort.
Probably I should mention that the logging out happens when the application starts. The user can't log out himself, the application does so when starting, so that the user should be forced to login each time. Yes, this has a reason ;)
I'm sure this is some kind of caching problem, but how can I solve it with Flash/AIR?
Bit late but better than nothing right? I have seen this issue before when I was experimenting with the OAUTH api...
Found the potential solution while looking for a separate issue but with regards to caching/cookies...
This post explains what you need to do:
http://cookbooks.adobe.com/post_Cannot_logout_from_Facebook_on_Android_devices-19254.html
Basically its not a very pretty solution, but what it does is you manually delete the folders where the caching is happening.
Hope this helps.
Implementing "reallyLogout" from this answer for a similar issue worked for me:
https://stackoverflow.com/a/8199505/952779
Clear internet explorer cache & cookies, .. and it will log you out from StageWebView facebook login
UPDATE: Change also the app id from the descriptor xml file