The blog continues at suszter.com/WindowsMobile

Saturday, February 11, 2017

Backward Compatibility of Windows 10 Mobile

This post discusses through a personal experience whether a Windows Phone 8.1 (WP81) app can run well on Windows 10 Mobile (W10M) devices.

It's my understanding that there isn't an official statement from Microsoft that WP81 apps continue to run on W10M devices.

When submitting your WP81 app to the store, you can select whether you want to make that app available for WP81 devices, for W10M devices, or both.

Additionally, you can choose to let Microsoft decide whether to make your app available for any future device families. It's not clear how Microsoft decides on it though. They likely run some tests and analysis internally for evaluation purposes before deciding whether to make that app available for any future device.

If your WP81 app doesn't work on W10M it does make sense not to make available for W10M devices till that app is fixed.

But is it possible that a WP81 app does not work on W10M devices?

Recently, I made my WP81 app available both for WP81 and W10M devices. Months after that app is out, when I was checking the Store Dashboard, I saw the app was crashing on a number of devices. Surprisingly, all the crashes occurred on W10M devices even though the app downloaded to WP81 devices twice as many times. Yet, no crash reported on WP81 devices.

It looks we can tell that WP81 app that can run well on WP81 devices can crash on W10M.

When I looked into the crashes I found crashes at places when the app interacts with other app. Particularly, my app crashed when using share feature enabling the app to send a photo to another app.

I couldn't reproduce the crash on any of my W10M devices. However, some time ago I remember seeing that the built-in Photo app crashed when sharing multiple photos with other app. It's kind of similar scenario and that's noting to do with my app.

It might be even possible that W10M devices running a WP81 app differently than WP8.1 devices running that app. That's why Microsoft probably doesn't say W10M is compatible with WP8.1 albeit they clearly try to make W10M to be backward compatible. It's just they can't guarantee backward compatibility.

Saturday, January 7, 2017

Casio Updated Their Smartwatch A Year Later

Casio just announced their new smartwatch that is an updated version of WSD-F10 released a year ago. They have many lineups such as the very successful G-SHOCK however WSD-F20 belongs to the Pro Trek lineup.

This time the watch has built-in GPS receiver which is reasonable because many of Casio's other watches have GPS for ages. Casio is the company has been taking slow but surely steps towards the success. They don't rush out with something unstable and even when they do experiment release they do it in the most careful way.

That's why FSD-F20 doesn't have any major upgrade.

There are articles on the news portal that missing the heart-rate monitor. If you know Casio you know they are not going to add it just because they could. They will add heart rate monitor if they see there is a good reason to add into the Pro Trek line. How many Pro Trek Casio watches do have heart rate monitor? Heart rate monitor technology has been available for ages. Casio just don't want to add something that doesn't fit into the objectives of the product line. Secondly, they don't add if the technology has a risk that would damage the reputation of Casio. I'm not sure if a heart rate monitor sensor can work for 20 years unlike most of the Casio watches.

The asking price $500 is a bit high according to the news. Casio have more expensive watches and they know less, and on the top of that they are just digital watches. For example, look at the Frogman. What you pay for is the quality. I'm sure you heard that someone returned their Microsoft Band, Fitbit, or other smart devices. Have you heard about someone returning their Casio watch because it got broken?

Sunday, October 30, 2016

The Challenges of Developing a Photo App for Mobile Devices: Memory Limits

Couple of months ago I started developing a photo app as a side project. The kick-off was ambitious but then I needed to admit I underestimated the complexity of the project as a casual mobile developer.

I was targeting Windows Phone and using managed language but it’s quite possible I’d have encountered similar experience with other platforms.

Development of a mobile app poses challenges and in this post I’m writing about one specific challenge I encountered.

The amount of memory an app can use is limited and it depends on the memory size of the device. If the device has 512 MB RAM the app can use only 185 MB of memory. If the app hits the memory limit it will crash.

One might assume if the app is written in managed language the unused memory will be regularly freed up and the app won’t hit the memory limit.

In my experience, it was easy to introduce a memory leak that gradually consumed the memory till the point the app hit the memory limit and so it crashed.

When the app is running it already using certain amount of memory. In one scenario the available memory was less than the amount of memory the app tried to allocate. As a result, the app hit the memory limit and so it crashed.

That point, I felt like being in the demoscene back in late ’90s when there were the competitions with specific limits. I knew what I wanted to do but I needed to make sure what I do doesn't violate the limits.

A photo app stores each pixel of the photo in the memory. A single pixel can occupy four bytes describing the color. So an image of 3552x2000 requires 27 MB of memory.

The calculation looks like this: ((3552*2000*4)÷1024)÷1024 = 27

One might think that 27 MB of memory in this example is little taking into account that 185 MB is the limit. It’s not that simple.

The photo app might need to keep multiple copies of the photo in the memory. For example, the app keeps both the original and edited photos in the memory.

The photo app might need to keep multiple photos in the memory. For example, the app might insert one photo on the top of another. The photo app might need to show a different image to the user than it holds in the memory. So both photos needs to keep in the memory.

Other than that, the photo app needs to keep other things in the memory like temporary buffers, pages of app, history, etc. When these are all add up it’s fairly easy to hit the memory limit.

The memory consumption of the app might not be exactly the same between two devices even when the devices have the same amount of RAM. So the memory consumption of the photo app not that just has to be lower than the limit but it’s advisable to leave a safety margin to be on the safe side.

Different devices have different amount of RAM and unless you want to optimize your code to the low-end device you need to deal with devices with varying amount of RAM.

I used Visual Studio’s built-in Performance and Diagnostics Tools to ensure there are no memory leaks. I also made a measurement how much memory is needed for certain resolution of photos. Then, I set a limit that the app won’t open large images that would lead to excessive memory usage and ultimately to crash. I wrote a memory manager class that checks the amount of memory available and adjusts the internal configuration of the app accordingly. As a consequence, certain functionalities — such as zooming into the photo — can take the advantage of more memory.

Thursday, January 7, 2016

Smartwatch from Casio with Dual Display

"There will only be chances later for those who take action now." -- Kazuo Kashio, 2008
I love Casio watches, heck Casio electronics, since my childhood which was 25+ years back. These days there are four Casio watches in my watch box that I regularly wear according to where to go. It's difficult to convey my opinion in an objective way about Casio WSD-F10 that will be reportedly released in March and April later this year.

I just saw the Casio press conference on YouTube. Casio say WSD-F10 created and designed specifically for outdoors and it's 50m water resistant. I would not hesitate to wear it outsize or in sea knowing it's built by Casio the maker of G-SHOCK watches. I just haven't had considerable problem with any of my Casio watches. Perhaps the worst thing was that I needed to replace the strap, once in 90's and once in 2000's I guess.

I saw the photo and the watch just looks so cool taking into account it's a smart watch. I still love my Rangeman, and I'm keeping an eye on the Bluetooth watches hoping they will support Windows Phone one day soon (I'm honestly sad about this but have hopes).

WSD-F10 has got DUAL DISPLAY. This is a big thing because the monochrome display can provide continuous time display. Also when you use the monochrome display rather than the color the battery can last many days or weeks. Casio say the battery can extend till 1 month -- I guess if you don't use the apps.

It has got sensors like compass, accelerometer, gyroscope, barometer. No thermometer? That would be useful, too. I got barometer in my Rangeman and it's pretty practical as you can predict weather changes. In Singapore, for example, I know if the pressure is going up high, then dropping fast it's likely will be raining soon, say, in the next hours.

It's got Android Wear OS on it that I'm not so happy about but Casio can't develop their own OS from scratch as they need to keep their focus on the watch.

Pre-installed apps like map can be really useful I guess specially with the use of compass.

It seems it doesn't have GPS built-in, but whether it can use to the phone's GPS via bluetooth is not clear.

It has got WiFi and bluetooth built in and it's used for notifications when the watch is linked with the smartphone. If it could be linked with Windows Phone that would be even better.

You can remotely operate Casio camera which means Casio take smartwatch seriously. At the moment, my heart however goes for the conservative Bluetooth G-SHOCK that sadly needs update to work with Windows Phone.

Monday, December 14, 2015

Reproducible Bug in MS-DOS Mobile

MS-DOS Mobile has a bug that causes an unexpected termination of the app when it is triggered.

The bug can be reproduced by following the steps below.
  • Open MS-DOS Mobile version 1.0
  • Type "cd windows" and press enter
  • Type "cd.." and press enter
  • Again, type "cd.." and press enter to observe the app terminates
It's not obvious whether the app crashes or terminates other way when the bug is triggered because in both cases the app exits.

Sunday, February 22, 2015

VirtualBox and Windows Phone Emulator (Hyper-V)

VirtualBox requires Hyper-V disabled but Windows Phone Emulator requires Hyper-V enabled. Since Hyper-V is either enabled or disabled I configured my system to have a boot menu for Hyper-V disabled.

I created the new boot menu with the following commands.

C:\windows\system32>bcdedit /copy {current} /d "Without Hyper-V"
The entry was successfully copied to {186a5a87-1050-11e4-8250-54ee7520341c}.

C:\windows\system32>bcdedit /set {186a5a87-1050-11e4-8250-54ee7520341c} hypervisorlaunchtype off
The operation completed successfully.

So I select between the menus during bootup depending on whether I want to use VirtualBox or do Windows Phone development.

Saturday, February 21, 2015

Displaying Binary Characters

The wrong way to display an array of random characters in the console (standard output) is like this.

    foreach (Byte by in buffer) {
        System.Console.Write(Convert.ToChar(by));
    }

It only displays ASCII characters (0-127) correctly. If you want your code to display ANY characters correctly you may use something like this.

    Console.OpenStandardOutput().Write(buffer, 0, buffer.Length);

Here is the complete example code.


You can download the source code here.