Windows Phone: Preload Existing Data to SQL CE Database

Ever since Windows Phone 7 Mango update, you can run a small database call SQL CE in your Windows Phone app. The SQL CE database in Windows Phone use code first approach instead of the creating table first like what you did in your desktop or web development. This mean you will write the classes for your table in database and all the table will be generated on runtime when you run your app on the phone. Yes, you can’t manually create the table and insert the data into the database during your development.

Although the database has all the necessary functions basic function that you need, but if you have a large set of data that you want to insert into the database then you will have a problem. Generate a large set of data and insert into the database when user run your app for the first time was a bad idea, because it might take too long time and it will create a bad first impression of user when they first use your app. You can use XML instead of SQL CE, but on a large data set, XML performance is much slower than SQL CE.

In my case is, I have a huge XML file for my Windows Phone app (over 40 MB). Accessing to the XML file take me more than 20 second to initialize, it was a pain. Finally I found an alternative way to insert a large volume of data to the database. first I need to create a new Windows Phone project and I program it to convert my huge XML data to the SQL CE database (Phew, it take me 30 minutes to run the conversation). Then, I copy out the database from isolated storage and put it into the project I want. Done, my app can now direct access to the database and save ton of startup time.

For step by step how to do this, please refer to How to: Deploy a Reference Database with a Windows Phone Application

by Ooi Keng Siang via Ooiks’s Blog

Windows Phone: ListPicker Problems and Solutions

In this post, I’m going to share my experience dealing with ListPicker which come from Silverlight for Windows Phone Toolkit (Sept 2010 edition). ListPicker is a very useful control to replace combo box type of control in Windows Phone, but currently version is too buggy and lot of work around needed. Here I’m share about the problem I face when using ListPicker and solution that I apply. Hope you can find it useful.


ListPicker Can’t Expend or Open Problem

This is a known bug in ListPicker. If you place the ListPicker in a ScrollViewer and the ListPicker can’t open in the full mode when user tap on it. The solution for this is manually open the ListPicker in FullMode when tap event is rise.


ListPicker Unable to Assign SelectedItem on Load / After User Select in Full Mode

Often we want to pre-select a SelectedItem in ListPicker which the application saved when the page load. The problem is if set  SelectedItem in page contractor like other controls, it still remain selecting the first item instead because it wasn’t loaded when you assigning  SelectedItem. If set on  PhoneApplicationPage_Loaded, it will work for the first time but when user tap on ListPicker and select a new value in full mode, the ListPicker will still remain the same SelectedItem. This is because  PhoneApplicationPage_Loaded will be call every time the page is load which mean when ListPicker full mode closed,  PhoneApplicationPage_Loaded will be call again and reset ListPicker SelectedItem again.

The solution for this is to put the SelectedItem in PhoneApplicationPage_Loaded event but make sure it is call one time only instead every time PhoneApplicationPage_Loaded is called. One way to do this use a class properties to keep track whatever ListPicker is initialized or not.



ListPicker Slow Performance Issue

If you have multiple ListPicker in the same page, you might notice the page will become unresponsiveness for the first one or two seconds when user navigate to the page. This is because multiple ListPicker take quite some time to load if you assign ItemSource in ListPicker during page constructor, on PhoneApplicationPage_Loaded event or on  OnNavigatedTo event. Setting  the CacheMode to BitmapCache won’t have solving the problem because it still need to load it for the first time.

I need the page to be responsiveness as soon as user navigate to the page. The only solution I can come out to solve this problem is to only load ItemSource to ListPicker when ListPicker is tap. Although this will cause ListPicker to open slower when user tap on it, but it is OK for me since I had more than 4 ListPicker and those ListPicker is just optional. Make sure you only assign ItemSource once instead of every time user tap on it.


That all for ListPicker currently. I hope all this information is useful for any one who face problem on ListPicker.


by Ooi Keng Siang via Ooiks’s Blog

Windows Phone: ListBox ItemsSource and List

In Windows Phone development, you can always assigning List<T> collection to a ListBox through ItemSource. If and only if you never remove any item in the List<T> collection before you assign the ListBox ItemSource to null first.

ListBox.ItemSource = SomethingList;

I encounter a situation where I display a list of items in a ListBox on my main page. Then user can to select the item in ListBox and edit or delete the item on the next page. Adding new item to the list or edit the item in the list doesn’t cause any problem at all. But if user delete any item on the second page and go back to the main page, the app will encounter an unexceptional error on App.xmal.cs. The error message show “The parameter is incorrect”, which give me no hint or clue what actually go wrong. Searching on the web for the error message or -2147024809 code give me no result at all.


After many testing I only figure out the problem that I assigning a List<T> collection to a ListBox was a bad idea especially the item can be remove by user during runtime.  The main problem here is ListBox won’t have know what happen to the List<T> collection when some items got removed on the other pages and yet it continue to assign to those items. The solution is simple, just replace the List<T> collection to ObservableCollection<T> collection. The different between List<T> and  ObservableCollection<T> is  ObservableCollection<T> will tell ListBox something changed and it need to update instead of crashing the whole app.

Now the problem had solved, but it doesn’t mean ListBox ItemSource must assigned to ObservableCollection<T> instead of List<T>. If the list of items wanted to display doesn’t change through out the app lifetime, it is still better to use List<T> because of it’s simplicity which save you more processing and memory.

by Ooi Keng Siang (Microsoft Student Partners) via Ooiks’s Blog

Windows Phone Marketplace Opens for Distribution in Malaysia

According to the Windows Phone Developer Blog, Windows Phone marketplace is now allow submit apps for distribution in 6 new markets; Argentina, China, Indonesia, Malaysia, Peru and the Philippines. This is such a great news to kick start year 2012 for Windows Phone developers in Malaysia. But wait, some developers are confused between submitting app targeting Malaysia market and marketplace availability in Malaysia.

I’m come out a list of questions and answers to help clear the doubt regarding this news.


Q: Is marketplace now available in Malaysia?

A: No, even though developers now can targeting Malaysia market when submitting their apps, but Windows Phone marketplace is still not available in Malaysia yet.


Q: When will Windows Phone marketplace available in Malaysia?

A: Microsoft did not make any official statement currently yet, but we can expect the marketplace coming very soon since it now allow apps targeting Malaysia market.


Q: Can Malaysia developers register in App Hub now?

A: No, not yet. Since the marketplace is not available yet.


Q: How can Malaysia developers submit their apps now?

A: Malaysia developers still need to submit their apps through third party company like Yalla App and they can select Malaysia as one of their distribution market.


Q: What is the additional requirement to submit apps targeting Malaysia market?

A: Content that consider as offensive in Malaysia local law are not allowed. Examples of potentially offensive content: [Source: 3.10 Country/Region Specific Requirements]

  • People in revealing clothing or in sexually suggestive poses
  • Religious references
  • Alcohol references
  • Sexual or bathroom humor
  • Simulated or actual gambling


Q: Why start developing Windows Phone apps now, even the marketplace is not available yet?

A: The biggest reason is to get a head start over the other when the marketplace is available. Since we can expect the marketplace coming very soon to Malaysia and apps that targeting Malaysia is still very limited now. This is a great opportunity to kick start a new apps targeting Malaysia users or porting your existing apps from other platforms and stay ahead from your competitors.


I hope this post give a better picture of what actually happen and what you as a Windows Phone developers in Malaysia can expect. If you have any questions, do post on the comment and I will try my best to answer it.

by Ooi Keng Siang via Ooiks’s Blog 

Bad Experience with App Exchange / App Gateway

Currently Windows Phone 7 Marketplace is not available in Malaysia, and the only way for Malaysia Windows Phone developers to submit our applications is through third party companies like Yalla App or App Exchange (they just rename their website to App Gateway recently, check the update in the end of this post). I personally experience the service offer by this 2 companies and App Exchange had pissed me off. If compare both Yalla App and App Exchange, App Exchange is just super duper terrible, horrible and vegetable! I think the “great service” offer by App Exchange deserve a blog post from me.

If you ever think of submit your app through App Exchange, below are the reason why you should go away:


I mean very expansive, a lot expansive.  Compare  Yalla App and App Exchange this two companies, Yalla App charge 1.00 USD for each app submission while App Exchange charge 39.99 USD (previously 19.99 USD) for each app submission. It is 40 times much more expansive to submit your app through App Exchange than Yalla App. It is just 99 USD to open an account in marketplace and yet App Exchange charge developer 39.99 USD for each app submission. Imagine how much they can earn when you submit your app through App Exchange.


Only Free App 

Even App Exchange charge high amount of fee on developer for each app submission, only free app is allowed currently. Yes, you wouldn’t earn a single sen through app download but only through advertisement put on your app only (if you got put advertisement in your app at the first place).


Terrible Customer Service

If you have a question about their service, don’t even think they will reply you in e-mail.  Seriously, they never reply e-mail. Previously, I submitted an app and they mess up my application description which they ignore all the formating I made, I complain this through e-mail, and they never reply my e-mail until today. While the other time I complain my app submission problem to them through e-mail, they also never reply my e-mail, completely! Customer service zero!


Horrible Website Design 

Once you open App Exchange website, you will find out. I guess any experience web designer or web programmer can create a better website than App Exchange website. Basically you can’t found any information on the website other than how you pay them! Unlike Yalla App, if you mistakenly submit a wrong size of icon image, Yalla App will stop you from completing the app submission, but App Exchange will let you submit and then reject your app later on (Yes, that cost you one time of app submission money).


Random App Submission Failure Reasons

You may receive some very funny random submission failure reason from App Exchange which is not from Windows Phone marketplace but App Exchange instead. I had submitted an app with the content in English language but App Exchange reject my app and said language used in my app was not supported so they fail to submit my app (Note: the report was generated by App Exchange not Windows Phone marketplace). Can’t they understand what is English? Never mind, I submit another app but also got rejected with the reason they can’t open my xap file! OK, why App Exchange need to open my XAP file? Aren’t Windows Phone marketplace is the one who will validate my app? By the way, this 2 case also cost one app submission fee even the app never went though any verification.


Incorrect Report

Don’t trust all the e-mail send by App Exchange. One of my friend who submitted an app through App Exchange and the app get published successfully on marketplace, but App Exchange e-mail my friend saying the app fail to go through verification process and attached a report from Windows Phone marketplace. The app had been published and App Exchange still want to earn more money by telling my friend to re-submit the app again?


Email Spamming

Without any reason, I receive lot of e-mail from App Exchange today telling me all the apps that already published on marketplace is published! Man, those apps was published long time ago, and you had notified me before this, why send the same thing to me again and again?


Now, you may wonder even with the terrible service of App Exchange and still I submitted multiple app through App Exchange. This is because I was pointed to submit my app through App Exchange and someone is paying the bill instead. I wound not pay a single sen for their terrible service. If you want to submit your Windows Phone application and Windows Phone marketplace is not available in your country yet, go ahead with other company like Yalla App and forget about App Exchange. Don’t ruin your app and your mood by going through all the terrible service.


Update #1: App Exchange had just renamed their service to App Gateway instead with the following reason.

Unfortunately, due to a Domain Name dispute, has claimed “” as belonging to them because they had before we registered our domain name. We have agreed to change our name and is now

Salesforce want to claim the URL? Really? That sound more like they just screw thing up and want to change to a new domain name and a new website name to brush away what they did before. Bad, very bad!


by Ooi Keng Siang via Ooiks’s Blog

Bug in AdMob SDK for Windows Phone 7 Version 4.0.4

Today, when I’m trying to continue working on one of my Windows Phone app and suddenly the app force quit every time I run the app. Man, it is working correctly last night and now it doesn’t work anymore! What the hack is this “An unknown error has occurred. Error: 80020101.”? The error did not give me a good idea what is it all about.

I can’t really guess what actually happening. After spending a long time checking what went wrong, then I found out Google AdMob control which I use to display advertisement is not working correctly and it keep on throwing error when it put into visual tree.  So I do some search and found out that the AdMob SDK has cause quite number of problems in current version. Lot of developers complain about this problem but no work around or fix is provided by Google.

I try several way like putting try/catch, generate ad from code behind, generate ad from loaded function and many more. All doesn’t work and it still throwing error, ARGH!! There are only 2 options left for me. First option, completely remove AdMob from my app and I will gain nothing from the app. Second option, ignore the error.

Since the app I created is pretty simple and it is for demo purpose, so I will keep the ad and ignore the error.  By setting exception handled to true, it should stop the app from force close when running. Of cause it will still pop up error when you running in debugging mode. I will just comment out the ad control coding part when I debugging the app and un-comment it when I finish develop it.

I had submitted the app to Windows Phone marketplace. I not sure whatever it can go through the certification process or not but I shall update this post when the result is out. Yes, my app get through the certification without problem. In the end, I still cannot figure out what is actually happening to the SDK which is working flawless for the pass 2 weeks and it now cause me so much trouble. Let’s hope the developer (Google) fix this mess as soon as possible. Meanwhile, only 2 options, either remove all or ignore it!

[Update] I had fix the problem using Ad Rotator instead, check out my latest post here.

by Ooi Keng Siang (Microsoft Student Partners) via Ooiks’s Blog

Get Advertisement on Your Windows Phone App

One very common way to generate revenue in phone application is through displaying advertisement. This is one of the very effective approach for free app to generate side income. Currently there are only limited number of mobile advertisement supported on Windows Phone 7. Thing is even worse because I live in Malaysia which lot of mobile advertisements did not support for my country.

Using Microsoft Advertising SDK might sound the most easiest way to put some advertisement on your Windows Phone application. But very unfortunately only limited number of countries is supported in  Microsoft  Advertising pubCenter. I only able to found Australia, Belgium, Canada, Finland, France, Germany, Italy, Netherlands, Norway, Spain, United Kingdom and United States for the country or state option when registering an account for Microsoft Advertising pubCenter. Although they claim they will support more counties in the future, but I bet there will be still a long time until it reach my country.

Next, I found Smaato who they claim supported in many countries and many different platforms that include Windows Phone 7. Well, they did have a very well documented SDK for Windows Phone 7, but supported in many different countries is a question mark for me. Every time my application request an ad from Smaato, it always return an error for me which is ‘no ads available’. At first I though this error is because they haven’t get my account ready yet but after some research, I found out that this error mean there is no ad available for the combination of device/location/category. There is very high chances that I won’t get any ad in near future with Smaato for Windows Phone in my country. If I can’t even get any ad, how can I generate any revenue through advertisement then? It might be work for you, but definably not me.

Lastly, I went through a post on the forum that some one manage to port AdMob SDK to Windows Phone platform, so I decided give it a try. AdMob is one of the popular choices ad provider for Android and iOS platform which had taken over by Google. Although AdMob main page did not mention anything about Windows Phone, but they already had an official SDK for Windows Phone platform (which is in beta currently). Sweet! You need to register an account first before you can see the SDK for download. It is pretty much simple and easy with just a few line of code to get the ad on my app. You can found how easy through the tutorial here.

Since AdMob is the only option for me, then I left no choice but use AdMob only. Hopefully there are more mobile advertisement company support Windows Phone and my country as well in the future.


[Update] This post is outdated, check out my latest post here instead.


by Ooi Keng Siang (Microsoft Student Partners) via Ooiks’s Blog

Tally Counter – My First Windows Phone 7 Assignment

Few week ago, I had gone through a Windows Phone 7 workshop conducted by Microsoft Malaysia for students. I was required to develop an application in order to try out the Windows Phone marketplace submission process. Lot of ideas flowing through my mind, but none of those great ideas can be completed within 2 days time limit. So I decided to create a simple application. Just a simple application doesn’t make thing interesting, so I did some research before I start coding (something I learn in Imagine Cup ya).

I decided to create a simple tally counter application. Then I do a simple search on Windows Phone marketplace for similar applications. As I expected, there are quite a number of similar applications out there, but I also found out that there are still room for improvement in this simple application through the reviews and comments from user posted on the other applications. Done with the research then I direct jump into development.

What user want in a simple tally counter app:

  • A big button to tap and increase the count
  • Undo button just in case they did some mistake
  • Previous count number

None of existing tally counter app can answer all 3 requirement of user, so the TallyCounter app I came out with:

  •  A simple and clean design of tally counter app.
  • Can count up to 9999.
  • Can tap at almost anyway on the screen to increase the count.
  • Move all unnecessary button like reset button to the top because I understand user always use their thumb to tap on the screen.
  • Undo button with extra bonus that the app can tell you up to  5 history records which you had just pressed for the last 1 seconds.
  • Previous count number as requested by a lot of user in the marketplace.


Without any problem, my app went smoothly through the certification of Windows Phone marketplace and it now up on the marketplace. You can check it out here. Yes, it is free and without any advertisement as I don’t have any reason to price a simple app like this.

In my opinion, Windows Phone marketplace is still very new. There are still a lot of improvement you can make on existing application which many had ignored like in my case which is a simple tally counter app. Next, I’m going to create an application for Magic the Gathering as I found out the features in most of the app out there in Windows Phone marketplace are far behind than other platform like Adroind or iOS.

by Ooi Keng Siang (Microsoft Student Partners) via Ooiks’s Blog