The one thing that irritated me the most about the Windows Phone 7 emulator the first time I used it was that the host computer keyboard is not directly mapped to the emulator. This means you by default have to use the software input panel that is built in Windows Phone 7.
I immediately looked for a solution and found some MSDN documentation on the keyboard mappings for the emulator.
To enable the keyboard in the emulator - press the PAGE UP key or PAUSE/BREAK key.
To disable the keyboard in the emulator - press the PAGE DOWN key PAUSE/BREAK key.
If you want to learn more then I suggest you check out this article called Keyboard Mapping for Windows Phone Emulator
Tuesday, October 26, 2010
Monday, October 25, 2010
Windows Phone 7 Unlocked Emulator
If are not pleased with the emulator that shipped with the Windows Phone 7 developer tools then here's a quick way to replace the trimmed down emulator with the full version
1) Create a back up of your current emulator image file, to avoid re-installing the developer tools if in case anything goes wrong. This file will be under [PROGRAM FILES (x86)]\Microsoft SDKs\Windows Phone\v7.0\Emulator\Images\ and is called WM70C1.en-US.bin
2) Find and download an unlocked image in your search engine of choice, search for WM70C1.en-US.unlocked :)
3) Once downloaded, Copy the unlocked emulator image to [PROGRAM FILES (x86)]\Microsoft SDKs\Windows Phone\v7.0\Emulation\Images\
4) Rename the unlocked emulator image to WM70C1.en-US.bin
5) Run the emulator :)
If all goes well you should be able to run the unlocked emulator and it should look like this:
I would advise to make sure that you can deploy and debug applications with Visual Studio. If not then you probably found an older version of the unlocked emulator image and you should try to search again for a newer version.
1) Create a back up of your current emulator image file, to avoid re-installing the developer tools if in case anything goes wrong. This file will be under [PROGRAM FILES (x86)]\Microsoft SDKs\Windows Phone\v7.0\Emulator\Images\ and is called WM70C1.en-US.bin
2) Find and download an unlocked image in your search engine of choice, search for WM70C1.en-US.unlocked :)
3) Once downloaded, Copy the unlocked emulator image to [PROGRAM FILES (x86)]\Microsoft SDKs\Windows Phone\v7.0\Emulation\Images\
4) Rename the unlocked emulator image to WM70C1.en-US.bin
5) Run the emulator :)
If all goes well you should be able to run the unlocked emulator and it should look like this:
I would advise to make sure that you can deploy and debug applications with Visual Studio. If not then you probably found an older version of the unlocked emulator image and you should try to search again for a newer version.
Friday, October 22, 2010
Chris' Puzzle Game for Windows Phone 7
I finally managed to find the time to complete my puzzle game for Windows Phone 7. This will be my first attempt to publish anything on the marketplace. Let's see how it goes!
If you're interested in how I made the game then I'll be more than willing to share. I might be able to post code directly as this is soon be available commercially, but I can always give some tips and share knowledge. I wrote a step by step article on how to Create a Puzzle Game for Windows Phone 7 using XNA. The puzzle game logic is described in this article and I pretty use the same logic.
If you're interested in how I made the game then I'll be more than willing to share. I might be able to post code directly as this is soon be available commercially, but I can always give some tips and share knowledge. I wrote a step by step article on how to Create a Puzzle Game for Windows Phone 7 using XNA. The puzzle game logic is described in this article and I pretty use the same logic.
Thursday, October 21, 2010
Motorola Dual Bluetooth Stack Support
Apparently most Motorola devices support 2 Bluetooth Stacks: Microsoft and StoneStreet. To switch which stack to use you would have to make some changes in the registry and restart the device.
[HKEY_LOCAL_MACHINE\SOFTWARE\SymbolBluetooth]
"SSStack"=DWORD:1
0 = Microsoft Stack
1 = StoneStreet One Stack
The StoneStreet One Stack is supported in all devices except the ES400 and MC65. For the Microsoft stack, any device running Windows Mobile 6.1, Windows Mobile 6.5.x and Windows CE 6.0
Motorola recommendeds using the Microsoft stack for new development and I strongly agree with Motorola on this!
[HKEY_LOCAL_MACHINE\SOFTWARE\SymbolBluetooth]
"SSStack"=DWORD:1
0 = Microsoft Stack
1 = StoneStreet One Stack
The StoneStreet One Stack is supported in all devices except the ES400 and MC65. For the Microsoft stack, any device running Windows Mobile 6.1, Windows Mobile 6.5.x and Windows CE 6.0
Motorola recommendeds using the Microsoft stack for new development and I strongly agree with Motorola on this!
Wednesday, October 20, 2010
Widcomm Bluetooth Pairing Prompt
Not so long ago I had a project that involved Bluetooth communication from a windows mobile device to some custom designed hardware. Everything went smoothly with only a few bumps during the scope of the project. When we had the applications on the field, certain users where running on devices that used the Widcomm Bluetooth Stack and that gave us a few headaches. For one, our system doesn't use any security features in bluetooth hence it doesn't not require pairing. Our security architecture is service based and checks for certain keys being passed back and forth to an online service. Very standard stuff. The problem we had with the devices running on a Widcomm Bluetooth stack was that the user was always prompted to pair even though the device did not require pairing. The application was not designed to handle user input aside from logging in/out and some diagnostic features. The application was designed to just run quietly in the background with the device tucked in the users pocket.
Since quite a few devices use the Widcomm Bluetooth Stack I needed a quick fix/hack to avoid the user having to pick up the device and click "Yes" on the security prompt to communicate with the device. The fix had to be as simple as possible and had to run without disrupting the user. My not so clean solution was to create a small application that does nothing but check if the Widcomm security pairing prompt app was running and if so send a keystroke event to simulate the user clicking on "Yes".
The Widcomm security prompt app main window uses the class name Broadcom_BTWizard with the window name Bluetooth. I check if this window exists and send the F1 keyboard event to simulate clicking on the left hardware button on the device
Here's a code snippet in C#
This is of course not the best solution but if you have a similar problem then this might save you some time if your only requirement is to get it to work as soon as possible. Otherwise, I would suggest avoiding the Widcomm Bluetooth Stack and just go for devices that use the Microsoft Bluetooth Stack
Since quite a few devices use the Widcomm Bluetooth Stack I needed a quick fix/hack to avoid the user having to pick up the device and click "Yes" on the security prompt to communicate with the device. The fix had to be as simple as possible and had to run without disrupting the user. My not so clean solution was to create a small application that does nothing but check if the Widcomm security pairing prompt app was running and if so send a keystroke event to simulate the user clicking on "Yes".
The Widcomm security prompt app main window uses the class name Broadcom_BTWizard with the window name Bluetooth. I check if this window exists and send the F1 keyboard event to simulate clicking on the left hardware button on the device
Here's a code snippet in C#
[DllImport("coredll.dll")]
static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("coredll")]
static extern void keybd_event(byte bVk, byte bScan, int dwFlags, int dwExtraInfo);
const int KEYEVENTF_KEYUP = 0x02;
const int KEYEVENTF_KEYDOWN = 0x00;
static bool running = true;
static void CloseBroadcomWindowWorker()
{
while (running)
{
var hwnd = FindWindow("Broadcom_BTWizard", "Bluetooth");
if (hwnd != IntPtr.Zero)
{
keybd_event((byte)Keys.F1, 0, KEYEVENTF_KEYDOWN, 0);
keybd_event((byte)Keys.F1, 0, KEYEVENTF_KEYUP, 0);
}
Thread.Sleep(5000);
}
}
This is of course not the best solution but if you have a similar problem then this might save you some time if your only requirement is to get it to work as soon as possible. Otherwise, I would suggest avoiding the Widcomm Bluetooth Stack and just go for devices that use the Microsoft Bluetooth Stack
Friday, October 15, 2010
Windows Phone 7 Game State Management using XNA
Not so long ago I wrote a Puzzle game for Windows Phone 7 using XNA. The game was really simple and had no menu or state management. Luckily, I recently stumbled upon a sample on MSDN that describes the basics of implementing game state management using XNA.
To try things out a bit more I modified my existing puzzle game and included the sample game state management code. The results are pretty amazing!
Here's how my Puzzle Game for Windows Phone 7 looks like now:
If you're getting into writing games for Windows Phone 7 using XNA then you should really check out the Game State Management sample here:
http://create.msdn.com/en-US/education/catalog/sample/game_state_management
I described in detail how I built my puzzle game application in an article called Writing a Puzzle Game for Windows Phone 7 using XNA. Try checking it out, I hope you find it interesting
To try things out a bit more I modified my existing puzzle game and included the sample game state management code. The results are pretty amazing!
Here's how my Puzzle Game for Windows Phone 7 looks like now:
If you're getting into writing games for Windows Phone 7 using XNA then you should really check out the Game State Management sample here:
http://create.msdn.com/en-US/education/catalog/sample/game_state_management
I described in detail how I built my puzzle game application in an article called Writing a Puzzle Game for Windows Phone 7 using XNA. Try checking it out, I hope you find it interesting
Monday, October 11, 2010
Microsoft Advertising SDK for Windows Phone 7
I recently stumbled upon the Microsoft Advertising SDK for Windows Phone 7. At the client side, it provides a control called AdControl that retrieves banner information based on the specified ApplicationId and AdUnitId. In order to use the Microsoft Advertising’s ad delivery system, you first need to create a Microsoft pubCenter account.
Here's some information extracted from the help file included in the SDK:
Sounds fairly simple but not everything can be perfect in a first release. The first problem I found was that the pubCenter Registration and Payment will only be available for publishers from the United States. So to be eligable for payments one must for example have a valid US address and a valid Tax Information Number (TIN) if the publisher is a business entity. As I'm not based in the US, I haven't tried this yet. But based on what I've read in the documentation, using the AdControl in a Windows Phone 7 application seems fairly easy.
Here are some C# and XAML snippets:
The following C# code instantiates a new AdControl and sets mandatory targeting parameters.
The following C# code instantiates a new AdControl with manual ad rotation.
The following XAML instantiates a new AdControl with mandatory targeting parameters.
I'm looking forward for these tools to be available in Europe so I can try them out.
Here's some information extracted from the help file included in the SDK:
The Microsoft Advertising SDK for Windows Phone 7 provides an AdControl that you can use to publish advertisements in Windows Phone 7 applications. The Microsoft Advertising AdControl communicates with Microsoft servers that deliver ads. When these servers return ads to the AdControl, the AdControl will render the ads within your Windows Phone 7 application.
In order to use the Microsoft Advertising’s ad delivery system, you first need to create a Microsoft pubCenter account. Microsoft pubCenter is an advertising publisher management system that enables you to create ad placements and collect advertising revenue. Once you create an account, you will register your mobile applications by using Microsoft pubCenter. When a Windows Phone 7 application is registered with Microsoft pubCenter it will receive a unique mobile application identifier (ApplicationId).
When a mobile application displays a window, the application can define a space within the window for the presentation of advertisements. Each ad placement that is presented is called an ad unit. You will define and create mobile ad units by using Microsoft pubCenter, and each mobile ad unit will be assigned a unique ad unit identifier (AdUnitId).
The ApplicationId and the AdUnitId are required for your Windows Phone 7 application to request ads from Microsoft Advertising’s ad delivery system. The ApplicationId and the AdUnitId identify the ad unit that is delivered to a Windows Phone 7 application and the publisher that will receive credit for displaying the ad unit.
It takes only a few easy steps to register with Microsoft pubCenter, create ad units, manage revenues, and integrate the Microsoft Advertising Mobile AdControl for Windows Phone 7 into your application.
Sounds fairly simple but not everything can be perfect in a first release. The first problem I found was that the pubCenter Registration and Payment will only be available for publishers from the United States. So to be eligable for payments one must for example have a valid US address and a valid Tax Information Number (TIN) if the publisher is a business entity. As I'm not based in the US, I haven't tried this yet. But based on what I've read in the documentation, using the AdControl in a Windows Phone 7 application seems fairly easy.
Here are some C# and XAML snippets:
The following C# code instantiates a new AdControl and sets mandatory targeting parameters.
AdControl ctrl = new AdControl();
ctrl.ApplicationId = "testapplication";
ctrl.AdUnitId = "testadunit";
this.ContentGrid.Children.Add(ctrl);
The following C# code instantiates a new AdControl with manual ad rotation.
string applicationId = "testapplication";
string adUnitId = "testadunit";
bool isAutoRotation = false;
AdControl ctrl = new AdControl(applicationId, adUnitId, AdModel.Contextual, isAutoRotation);
ctrl.Width = 480;
ctrl.Height = 80;
this.ContentGrid.Children.Add(ctrl);
The following XAML instantiates a new AdControl with mandatory targeting parameters.
<Grid xmlns:adctl="clr-namespace:Microsoft.Advertising.Mobile.UI;assembly=Microsoft.Advertising.Mobile.UI" Grid.Row="1">
<adctl:AdControl Height="80" Width="480" AdUnitId="Test" ApplicationId="Test" AdModel="Contextual" />
</Grid>
I'm looking forward for these tools to be available in Europe so I can try them out.
Wednesday, October 6, 2010
How to retrieve a list of installed applications using .NETCF
In this short post I'd like to demonstrate how to retrieve a list of installed applications on a Windows Mobile device using OMA Client Provisioning. First you need to add a reference to the Microsoft.WindowsMobile.Configuration assembly. To retrieve the list we need to process a specific configuration (UnInstall Configuration Service Provider) using the ConfigurationManager.ProcessConfiguration method. The configuration is described in an XML and the response to this will also be described in XML
To query the device we process this configuration:
The query above will only return installed application that can be uninstalled. The device would then respond with something like this:
And here's how to accomplish this task using .NETCF and C#
I hope you found this useful.
To query the device we process this configuration:
<wap-provisioningdoc>
<characteristic-query type="UnInstall"/>
</wap-provisioningdoc>
The query above will only return installed application that can be uninstalled. The device would then respond with something like this:
<wap-provisioningdoc>
<characteristic type="UnInstall">
<characteristic type="Microsoft Application#2">
<parm name="uninstall" value="0"/>
</characteristic>
<characteristic type="Microsoft Application#1">
<parm name="uninstall" value="0"/>
</characteristic>
<characteristic type="Demo Home Screen">
<parm name="uninstall" value="0"/>
</characteristic>
</characteristic>
</wap-provisioningdoc>
And here's how to accomplish this task using .NETCF and C#
var doc = new XmlDocument();
doc.LoadXml(@"<wap-provisioningdoc><characteristic-query type=""UnInstall""/></wap-provisioningdoc>");
doc = ConfigurationManager.ProcessConfiguration(doc, true);
var nodes = doc.SelectNodes("wap-provisioningdoc/characteristic[@type='UnInstall']/characteristic/@type");
foreach (var node in nodes.Cast<XmlNode>())
{
Trace.WriteLine(node.InnerText);
}
I hope you found this useful.
Subscribe to:
Posts (Atom)