Just a quick note on the Windows Phone Week event that’s kicking off in two days. A while back my Windows Phone Dev MVP friends Joost, Matteo and Rodolpho had the crazy idea of organizing some wpdev events around the world together. The event started growing and with the first event kicking of this monday we have a total of 19 events scheduled around the world.
So what is App Studio?App Studio is a tool that will help you build a Windows Phone app in 4 simple steps:
- Have an idea
- Add content
- Choose Style
- Use it!
What do I need to get started?App Studio is a fully web based tool, all you need to get started is a Microsoft Account. It would also make sense to have a Windows Phone to actually test your apps, but it isn’t strictly required. That’s basically all you need, now head over to http://apps.windowsstore.com to get started. There’s some resources to help you get started:
- Recent blogposts on the official Windows Phone Developer Blog
- Windows Phone App Studio forums
- Windows Phone App Studio UserVoice (if you have feedback)
Next steps?This post marks the start of a series of blogposts that will help you make the most out of your App Studio experience. Give it a try yourself and come back over the course of the next days for more tutorials.
Update: After the whole uproar caused by this and other posts around the web Google decided to revert back to the old situation. I hope it also showed Google that a lot of Windows Phone users do like Google’s services and that they should see if improving the whole experience is possible. Turns out they’re not that evil in this case after all. Head over to The Verge for more details.
The original article was posted when Google Maps was inaccessible to Windows Phone users.
Yesterday reports started showing up that Google is redirecting all Windows Phone users away from the mobile Google Maps website. There’s been quite some discussion on why Google is doing this. Are they doing it to mock Windows Phone users? Or is IE10 mobile just not capable of rendering Google Maps the right way?Here’s Google’s official statement:
The mobile web version of Google Maps is optimized for WebKit browsers such as Chrome and Safari. However, since Internet Explorer is not a WebKit browser, Windows Phone devices are not able to access Google Maps for the mobile web.I used Google Maps before occasionally (Nokia Maps for Windows Phone does it’s job, so you won’t need Google anyway) and although the experience wasn’t perfect it definitely worked. Microsoft responded to Google’s statement with a very simple and clear statement:
Internet Explorer in Windows Phone 8 and Windows 8 use the same rendering engineI ran a few experiments to see what is really going on here.
Google Maps on Windows Phone with an Android UserAgentGoogle is detecting Windows Phones by their User Agent. By running my connection through a proxy and using a script to present a different UserAgent I tried to open Google Maps. Not surprisingly it just worked. I used this UserAgent:
Mozilla/5.0 (Linux; U; Android 2.3.4; fr-fr; HTC Desire Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1Want to try this yourself? Use Fiddler! Through Rules -> Customize rules you get to a textfile specifying scripts dat Fiddler runs when processing network calls. Adding oSession.oRequest["User-Agent"]=”Mozilla/5.0 (Linux; U; Android 2.3.4; fr-fr; HTC Desire Build/GRJ22) AppleWebKit/533.1 (KHTML, like Gecko) Version/4.0 Mobile Safari/533.1″; to the OnBeforeRequest part changes the UserAgent on all webrequests.
Playing around with Google ChromeOn Twitter some users reported that Google is just detecting the string “Windows Phone” disregarding any other information. This was obviously worth a try, so I moved to my desktop browser (Chrome). This is the UserAgent of Google Chrome on my desktop:
Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11To give it a shot I added “Windows Phone” to this string:
Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.11 (KHTML, like Gecko) Chrome/23.0.1271.97 Safari/537.11 Windows PhoneNow navigating to Google Maps again I got redirected away.
Another experimentMatthias Shapiro uploaded a video to YouTube where he proves the same point. Using a WebView within a Windows Phone app you can manually specify a UserAgent. Here’s what happened:
So what does this mean?Google’s own statement suggests that not supporting WebKit is the problem here, however the experiments mentioned show that there doesn’t appear to be any real problems. Combine this fact with some other recent development like Google removing ActiveSync support for Gmail users and Google still blocking a fully featured YouTube app for Windows Phone. It just shows that Google is just mocking Windows Phone and its users, something TheNextWeb also realized. It’s just another chapter in the ecosystem war. It’s also worth noting that 3rd party Google Maps apps for Windows Phone like gMaps still work.
Do we care?The real victims here are the regular Windows Phone users. If they happen to use GMail they want to get it on their phones, if they happen to need Google Maps they just want to access it. Fortunately Gmail still works for current users and I’m counting on Microsoft to provide a decent solution in the future. For the Google Maps part I actually really don’t care. Nokia Maps for Windows Phone is native, it has a great experience and offers practically all the features that I would use with Google Maps (maps, traffic info, local search, etc.). But for a company like Google that says:
Google’s mission is to organize the world’s information and make it universally accessible and useful.All those moves appear to be a bit sad. Google was always praised for it’s openness, but they’re acting more and more like Microsoft was back in the 90s (and that’s NOT a good thing)
- Google Analytics (using MSAF)
- Preemptive Runtime Intelligence (less interesting since their deal with MS ended)
- Marketplace submissions/choosing the right name/logo/description
- Trial API
- Marketplace and Social media “Tasks”
- App promotion/marketing
- Reporting (App Hub, Distimo, etc.)
- Analytics (using mtiks)
If you would like to contact me feel free to do so in the comments, the contact form or Twitter. And do share your WP7 succes stories!
Detection processFirst of all it is important to realize that the Ingestion Tool does not scan the actual C# and XAML (that’s not included in the XAP package anyway). The actual scanning happens on the Intermediate Language (IL) that is generated by the compiler. This is important to keep in mind when implementing this workaround.
Detection rulesEssentially both the Marketplace Test Kit and the App Hub itself use the same set of rules to determine what capabilities are required. Fortunately those rules are supplied with the Test Kit in understandable XML format. To find out what class you need to reference to force detection it is sufficient to check this list of rules. The rules.xml can be found in “C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v7.1\Tools\Marketplace” For example here’s the part on the ID_CAP_MICROPHONE capability.
<Capability ID=”ID_CAP_MICROPHONE” Type=”Security”> <Assembly Name=”Microsoft.Xna.Framework, Version=18.104.22.168, Culture=neutral, PublicKeyToken=842cf8be1de50553″> <Namespace Name=”Microsoft.Xna.Framework.Audio”> <Class Name=”Microphone” /> </Namespace> </Assembly> <Assembly Name=”Microsoft.Phone.Media.Extended, Version=22.214.171.124, Culture=neutral, PublicKeyToken=24eec0d8c86cda1e”> <Namespace Name=”Microsoft.Phone”> <Class Name=”Camera” /> <Class Name=”PhotoCamera” /> <Class Name=”VideoCamera” /> </Namespace> </Assembly> </Capability>
Forcing detectionThe rules.xml file basically tells you what classes to reference to force the detection (I highlighted them). In any case you can just add a dummy file (either xaml or just cs) and make a reference to just one of these classes. In case of the Microphone @lancewmccarthy suggests this line:
Microphone microphone = Microphone.Default;This is a Microphone-specific solution. Another option is to just add this line:
Microsoft.Xna.Framework.Audio.Microphone temp = null;This is where you need to remember the code gets compiled before scanning. The compiler implements a lot of optimization which in this case would lead to discarding a variable that is never accessed. Adding another line that references the variable solves this. This can be pretty much anything, for example:
MessageBox.Show(temp.ToString());If you would actually run this code it will always throw a NullReferenceException, but since this is a dummy file that will never happen. Although the code is unreachable the ingestion tool notices it. You can use the Marketplace Test Kit to verify this.
ConclusionBy combining the information in the rules.xml with a simple dummy file you should be able to force detection of any capability. The other way around rules.xml can also help you identify why a certain capability gets detected. Do you come across any problems when using this method? Feel free to leave a comment or send me a tweet.
CauseWe investigated the problem together with the Microsoft Marketplace Dev Support team. We figured out the crash was related to the specified capabilities. To play background audio the agent relies on the ID_CAP_MEDIALIB capability. This was specified in our manifest-file, but during the submission process the required capabilities are analyzed and overwritten. Apparently the App Hub contains a bug causing the medialib capability to remain undetected in certain situations. When using the Marketplace Test Kit the same problem shows, it does NOT detect the medialib capability. When the application tries to execute any action related to this capability it simply throws an exception and crashes.
SolutionObviously this is a bug in the Marketplace Ingestion tool that Microsoft needs to fix. The support team states: “I can tell you that it’s a known problem at our side that Engineering Team is already investigating”. Fortunately there’s a pretty obvious and easy workaround to solve this problem. Just add a “dummy” page to your application. Add elements to this page the ensure detection of the missing capability. In my case we forced detection of the MediaLib capability by inserting a MediaElement and making sure at least the x:Name is specified( <MediaElement x:Name=”DUMMY” />). Now both the Marketplace Test Kit and the App Hub’s ingestion tool will detect the capability therefore solving the problem. Update: The support team also provided me with some other workarounds that are easier and cleaner, but still force detection of the missing MEDIALIB capability. If your app is referencing any of these libraries just add the one line of code to your app.
|If it’s referencing:||Then add:|
|Microsoft.Phone.dll||Microsoft.Devices.MediaHistory history = null;|
|Microsoft.Xna.Framework.dll||Microsoft.Xna.Framework.Media.MediaLibrary lib = null;|
|none of the above ones, so very likely it’s at least referencing System.Windows.dll||System.Windows.Controls.MediaElement me = null;|
Would you like this feature to be integrated into the WP7 emulator? Vote here!An important aspect of every mobile application that uses the internet connection is the way it handles slow connections. As a developer you cannot predict if you are app will be used over high-speed UMTS or slow GPRS. In WP7 development there are some API’s available to determine the connection type, but you can never be sure about the exact speed. To ensure the best experience for your users testing some scenarios is very important. Unlike the Android emulator, the Windows Phone emulator does not provide any functionality to limit the network speed, but there are some alternatives that don’t require you to take your phone to the middle of an empty desert. In this post I will cover throttling of the network connection using NetLimiter.