SQLite Problem in Universal Windows Platform

Since they are no SQLite library that direct support Universal Windows Platform (Windows 10 app) currently yet, we are force to use the SQLite for Windows 8.1 instead. For those who use SQLite in Windows 8 / 8.1 app and wanted to upgrade their project to Universal Windows Platform, you may encounter th following message if you try to follow the tutorial of adding SQLite to Windows 8.1 project.

An exception of type ‘System.DllNotFoundException’ occurred but was not handled in user code

Additional information: Unable to load DLL ‘sqlite3’: The specified module could not be found. (Exception from HRESULT: 0x8007007E)

Continue reading SQLite Problem in Universal Windows Platform

Comparing Ad Providers in Windows Phone (My Experience)

More and more ad providers are starting to provider ad service for Windows Phone platform. As a Windows Phone developer, I find it very difficult to find any blog post or review comparing the ad providers in Windows Phone. (You can find a lot for Android and iOS.) I’m writing this blog post according to my own experience as a Windows Phone developer dealing with the ad providers. Hopefully this can help you select which ad providers to include in your apps without going through too much trouble.

 

Before you continue read this post, you need to understand the following things:

  • The fill-rate, CTR (click through rate), eCPM (pay per thousand impression) and eCPC (pay per click) are vary according to app, category, country and platform.
  • I only used the SDK for Windows Phone 7 version the ad providers given instead of Windows Phone 8 version since I wanted to support as many device as possible.
  • The list below are sorted according to my own preference according to their performance previously.
  • Those are my own experiences, it maybe vary from others.
  • Please don’t compare the eCPM or eCPC with other platform like Android or iOS… just don’t.

Continue reading Comparing Ad Providers in Windows Phone (My Experience)

Memory Leak in Inneractive Ad SDK 1.1.2 for Windows Phone 7

Recently I have been trying different advertisement providers for my Windows Phone apps. Inneractive was one of them. It is relative easy to setup and the SDK is well documented. Everything go smooth at first, then I realize my app force close due to running out of memory for a few times which cause me to investigate what actually cause the memory leak in my app.

After spending a lot of time investigate what went wrong, I suspect Inneractive Ad control was causing the memory leak. This because whenever the ad is show in my app, the memory is not release completely after the page is close. In order to prove that, I have created a 2 page Windows Phone project with Inneractive ad control and I was right. The Inneractive ad control is leaking memory. Although the amount is small, it is important in my app because I display at 2 ads in one page and this can really drive up the memory very fast and force the app to terminate.

Continue reading Memory Leak in Inneractive Ad SDK 1.1.2 for Windows Phone 7

Windows Phone – Max Database Size Problem in SQL CE

If you have encounters an SQLCeException error during a LINQ operation for example Union on a very large data set, check the error message. If the error message shows something like “The database file is larger than the configured maximum database size. This setting takes effect on the first concurrent database connection only.“, then congratulation to you, because you just hit the limit.

The Windows Phone team think any application in phone should not use that much memory, but still some of us might hit this limit. For example like me which required to search through 20,000+ data sets with complicated search conditions. The solution to this problem is pretty simple, add a max database size in the connection string to SQL CE. You will need a complete connection string this time instead of just defind the location of your SQL CE database file.

For example, my connection string before this is as follow:

@"isostore:/CardsDatabase.sdf"

Then after adding the max database size parameter and convert it to a complete connection string, it will become like this:

@"Data Source='isostore:/CardsDatabase.sdf';Max Database Size=64;"

The 64 in the connection string mean I wants to increase the max database size to 64 MB instead of the default value. Hope this little information can help.

by Ooi Keng Siang via Ooiks’s Blog

Building Windows Phone 7 App on Windows 8

With the release of Windows Phone SDK 7.1.1 Update, building Windows Phone 7 app on Windows 8 is now possible. I decided to jump on and try out Windows 8 while building my Windows Phone app, but I hit the wall right after I install Windows 8, Visual Studio and all the SDK then compile my Windows Phone app. Visual Studio told me that Microsoft.Xna.Framework.dll (which is use to play sound in my Silverlight app) is not found.

Aren’t the new 7.1.1 update suppose to make everything all right? It turn out that there are some problems with XNA which didn’t get installed when I run Windows Phone SDK 7.1. After some searching on the net and I found the solution for this. Just simple follow the following step by step:

  1. Download and install Zune Software (if you haven’t install)
  2. Download and install Games for Windows Marketplace Client
  3. Download and install Windows Phone SDK 7.1
  4. Download and install Windows Phone SDK 7.1.1 Update

Oh, just in case you installed everything but without the  Games for Windows Marketplace Client, you will need to repeat the step 2 to 4 (if you haven’t install Zune, then you need to repeat step 1 to 4).

Although everything work perfectly OK, but the emulator is a little bit lag compare running on Windows 7 which was a known issue in Windows 8.

 

Source

 

by Ooi Keng Siang via Ooiks’s Blog

Windows Phone – Contact Data Cannot Persist in Isolated Storage

Last few days, I was trying to develop a new project that involve saving some Contact data from phone to isolated storage or IsolatedStorageSettings. The reason behind this , I want the app to keep track of a list of favorite contacts. Everything went smooth until the part saving the contacts into isolated storage. It was a nightmare. Saving a copy of contact data into isolated storage did not give me any warning or problem at all. However after I quit the app and restart, the app fail to retrieve any contact data from isolated storage. It look like the app never successful save any data to the isolated storage.

 

public List<FavoriteContact> LoadFavoriteContactsFromStorage()
{
    try
    {
        if (IsolatedStorageSettings.ApplicationSettings.Contains("FavoriteContacts"))
        {
            List<FavoriteContact> tempFavoriteContacts;
            if (IsolatedStorageSettings.ApplicationSettings.TryGetValue<List<FavoriteContact>>("FavoriteContacts", out tempFavoriteContacts))
            {
                return (tempFavoriteContacts);
            }
        }
    }
    catch
    {

    }

    return (new List<FavoriteContact>());
}

public void SaveFavoriteContactsToStorage()
{
    IsolatedStorageSettings.ApplicationSettings.Remove("FavoriteContacts");
    IsolatedStorageSettings.ApplicationSettings.Add("FavoriteContacts", FavoriteContacts);
    IsolatedStorageSettings.ApplicationSettings.Save();
}

 

At first, I though I did something wrong in load or save function related with isolated storage. After debugging the whole day, it turn out that the function work perfectly OK without any problem. It did not throw me a single error at all. After Bing here and there on the Internet, at last I found culprit of this problem. It is the Contact data itself. In the Best Practices for Contact class, I found the following message:

Contact data is provided as a read-only snapshot. If your application needs fresh data, repeat the original search periodically.

Although the app did not throw any error, warning or exception, but I think it is not possible to direct save the Contact object into the isolated storage. Why I think instead of I’m very sure? This is because I can’t find any information related witht the same problem I’m facing, so I assume read-only Contact object can’t be saved. I replace the Contact class with another class I build with the similar properties with Contact class, then everything work nicely.

The conclusion here is you can’t save Contact object to isolated storage or IsolatedStorageSettings . No error, warning or exception if you do that, but it just don’t work and it will screw your whole day by letting you figure out what happen actually.

by Ooi Keng Siang via Ooiks’s Blog

Get Advertisement on Your Windows Phone App with Ad Rotator

Displaying advertisement in free app to generate some extra revenue is a very common approach use by many developers in many different platform. If you are living in the country where  Microsoft Advertising pubCenter is supported, then good for you because you will have a much easier life. But if you are not, or would like to show not only ad from Microsoft provider, then this post if for you.

I had personally tried Google AdMob and Smaato ad provider for Windows Phone before. They don’t work out nicely for me. Google AdMob SDK crash randomly when request ad from server (post). While Smatoo didn’t show any ad in the app some time when use in my home country (post). Microsoft Advertising pubCenter  is not an option for me since it is not available in Malaysia.

Then I come across Windows Phone 7 Ad Rotator, which can show ads from different providers. It support both Google AdMob and Smaato, so I decided to give it a try. End up it work perfectly in my app. The Ad Rotator solve the crash problem in Google AdMob native SDK (now I can use back AdMob) and it also help to display ad from different providers when the other provider fail to show any ad. For example, I set both Smaato and AdMob in Ad Rotator, when AdMob fail to show any ad,  Smaato will take over and show the ad instead. This help to maximize the revenue of your free app in many different countries.

Currently Ad Rotator is in version 1.0 which support Microsoft PubCenter, AdDuplex, Google AdMob, Inner-Active, MobFox, Smaato and Default House Ad. It also support both Silverlight and XNA app in Windows Phone. You can find a very easy tutorial here. It is very easy to integrate in your Windows Phone app. I will recommend any developer who want to show advertisement on their free app to give this a try.

I had now switch to Ad Rotator to display ads from Smaato and AdMob. Mainly because it can switch between different providers. When one failed to show, the others will take over. Second, I can add more ad providers later on without making any changes in my source code. Although I can further maximize the revenue by using different ad providers in different countries (eCPM will depend on the ad display, country and ad provider), but I don’t have any idea which ad provider give better pay on which country yet, so I will stick with 50-50 for Smaato and AdMob currently.

by Ooi Keng Siang via Ooiks’s Blog

Windows Phone: Unzip / Extract Compressed Files for Silverlight

I’m don’t really understand why compress or zip function was not added to Silverlight or Windows Phone since the Silverlight package or Windows Phones xap file was actually a zip file. Windows Phone will need to unzip all file download from marketplace in order to install in the phone. While I’m looking for a third party library to unzip file in my Windows Phone app, I come across this REALLY small unzip utility for Silverlight, which re-use the existing functions in Silverlight to done the job. Great, this is just what I looking for and the best part of it, the size is really small. It is just a C Sharp file!

A very simple tutorial for REALLY small unzip utility for Silverlight was provided on his blog but I found a missing function in the code. The GetFileNamesInZip can’t be found by Visual Studio. After taking a quick look in the source file, I found out that the function name was changed to FileNamesInZip instead. Below are the same example but with corrected function name call instead.

private void LoadZipfile()
{
    WebClient c = new WebClient();
    c.OpenReadCompleted += new OpenReadCompletedEventHandler(openReadCompleted);
    c.OpenReadAsync(new Uri("http://www.mydomain.com/myZipFile.zip"));
}

private void openReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
    UnZipper unzip = new UnZipper(e.Result);
    foreach (string filename in unzip.FileNamesInZip())
    {
        Stream stream = unzip.GetFileStream(filename);
        StreamReader reader = new StreamReader(stream);
        string contents = reader.ReadToEnd();
        MessageBox.Show(contents);
    }
}



Download REALLY small unzip utility for Silverlight  

by Ooi Keng Siang via Ooiks’s Blog

 

MTGBugs: Now Available on Windows Phone Marketplace

MTGBugs is a comprehensive app or tool for Magic the Gathering player. It integrate all kind of different tools which required by Magic players in one single app. For example life counter, dice roll, offline cards database, online card pricing, deck builder analysis, latest news update and many more. MTGBugs currently is the only app in Windows Phone marketplace with the most complete features builds into it.

MTGBugs main features include:

  • Game tracker include life and poison counter, game timer, mana pool counter, random dices
  • Commander format support up to 12 players with commander cast counter and achievements check list
  • Offline cards database with 20,000+ cards collection and online card pricing integrated (All prices courtesy of TCGPlayer.com)
  • Decks builder with up to date winning deck lists and automatic analysis tool build in
  • Wishlist and direct purchase through online shop from TCGPlayer.com
  • Online news direct from Daily MTG, StarCityGames, ChannelFireball and TCGPlayers
  • Photo capture and sketching tool to record opponent hand’s cards

Continue reading MTGBugs: Now Available on Windows Phone Marketplace

Windows Phone: Ready for the Marketplace in Malaysia

You may have notice Malaysia country is now listed in Windows Phone website. If you go to the marketplace, you can now search app that is available in Malaysia marketplace. This mean that the Windows Phone marketplace is ready for Malaysia consumers. Malaysia developers hold your horse, app submission to App Hub directly is not ready yet and you will still need to go through third party currently, check out my previous post.

The very first thing that piss me off is I can’t change the language to English if I selected Malaysia as the country in the website. Malay language was the only language provided. Why? Running translation in my head full speed while browsing the site is killing my brain cell. Fix this please! OK! enough, back to the topic.

You may found there are lot fewer apps in Malaysia marketplace compare with US marketplace. This is because many apps was submitted before Malaysia marketplace is ready for distribution. This mean that unless developers of those missing apps resubmit their app and select distribution to Malaysia, else it won’t be available to Malaysia marketplace. This doesn’t sound bad at all, because usually app that no longer updated are some useless app, so this can pretty much filter a lot of useless apps in Malaysia marketplace.

As for now Malaysia developers still need to submit their apps through third party like Yalla Apps in order to publish their apps to Malaysia marketplace and other country marketplace. Some developers still refuse go into Windows Phone development because they worry what will happen to their apps once the marketplace is fully open for developers in Malaysia and they can submit their app direct through App Hub. From what Microsoft and Yalla App done previously, developers can transfer their app to App Hub when it is fully open. Check out this post. So this is the best time to jump into Windows Phone development.

The news has been confirmed at Windows Phone Blog.

I’m still waiting for one of my fully developed app to get through the app submission and my new Windows Phone to ship to my hand. Such a long wait before I can play the fun out of it.

By Ooi Keng Siang via Ooiks’s Blog