Porting Week View to UWP and some unexpected problems

Update 2: The last preview build in the fast ring for WM10 (10.0.14267.1002) also did not fix this bug.
So I have lost my hope that this will be fixed before the rollout of WM10 for all devices, which currently is expected for 02/29/2016.

This is how the dialog should look like (and does in the built in calendar), when calling the method „ShowAddAppointmentAsync“:

wp_ss_20160220_0004_40

This is, how the dialog actually does look like:

wp_ss_20160220_0003_40

As described below: This bug only occurs on windows phone 10 and of course is not app related, it occurs in all calendar apps in the store.

Update: Today (11/02/2016) I installed the latest build of windows mobile 10 on my Lumia 925 test-phone, which is 10.0.10586.107. The bugs in the OS, which are described below, still exist.

Today I want to write a bit about my experience from a developers perspective, trying to port my existing app „Week View“ to the universal windows platform so it can run on all  windows phone 10 devices and on windows 10 for the desktop and tablett. 🙂

I am using my new Lumia 950 as a test device since windows phone 10 is the way to go…if you like beta testing an unfinished product. 🙁

So you will not read about problems like MS built in apps crashing quite often, for example when you try to upload pictures to OneDrive manually, since the automatic upload never happened for some pictures although configured.

I will also not write about the „Loading…“ screen that you will see quite often, crashes of the messaging app and crashes of the email app since I hope these will get fixed as soon as MS is finally able to deliver updates to windows phones. I was not able to get windows 10 mobile build 10586.29 for my new Lumia 950 so far. 🙁

According to MS, windows phone 8.x app will continue to run on windows phone 10 and if you simply start a windows phone 8.x app on a windows phone 10 device it most likely will run.

But beside from simply „running“, will it also work the way you expect and behave the same way as it did on windows phone 8.x? Unfortunately, the answer is: No.

Even worse: Many of the problems are related to the OS itself and so cannot be fixed by the developer

To illustrate this, I will use my Lumia 630, running windows phone 8.1 and as said my new Lumia 950, running windows phone 10 and execute the same methods for interacting with appointments.

So I am using 2 equal apps, with the only different that they are targeting 2 different platforms.

  • One app based on WinRT that can run on WP8.x devices (like my Lumia 630) AND on  WM10 devices (like my Lumia 950) since WM10 can run WP8.x apps
  • An app targeting the UWP (universal windows platform) that will run on the WM10 device (Lumia 930) only

The app(s) do simple CRUD operations with appointments and show a list of existing appointments. The text of the Buttons relate to the called methods of the SDK. The List below show an obfuscated list of my appointments.

Startscreen of the Win RT App, running on Lumia 630

Start screen of the Win RT App, running on Lumia 630

Startscreen of the App

Start screen of the Win RT App, running on Lumia 950

Start screen of the UWP App, running on Lumia 950

So lets start. 🙂

  • Creating a new appointment

For creating a new appointment, we need to get a reference to the appointment store.

Hint: You need to enabled „Appointments“ in the Capabilities of your app package manifest or the app will crash on startup.

private AppointmentStore _appointmentStore;
_appointmentStore = await AppointmentManager.RequestStoreAsync(AppointmentStoreAccessType.AllCalendarsReadOnly);

Next we can call a method of the appointment store to add an appointment

var rect = new Rect(new Point(Window.Current.Bounds.Width / 2, Window.Current.Bounds.Height / 2), new Size());
var appointment = GetTestAppointment();  // returns an appointment that has some data assigned
var result = await _appointmentStore.ShowAddAppointmentAsync(appointment, rect);

Quite simple and that’s how it is done in Week View and all other existing calendar apps for windows phone 8.x. The call to „ShowAddAppointmentAsync“ shows a dialog where a user can enter data of an appointment and hit „Save“ or „Cancel“. That’s how it works on Windows phone 8.1, please see the screenshots below, taken from the Lumia 630.

AddAppointment_1_Lumia630 AddAppointment_2_Lumia630

Note: Selecting the reminder time is possible in this dialog.

On WM10, things are different. When calling the exactly same method, the dialog below will be shown.

Result of calling the 'ShowAddAppointmentAsync' method.

Result of calling the ‚ShowAddAppointmentAsync‘ method in the WinRT and UWP App.

The result is the same in the WinRT App and the UWP App running on the WM10 device: The user can no longer edit any of the appointment values, select a calendar, select a reminder, …

This is a breaking change that affects all existing calendar apps, which use this method provided by MS and since this IS the way to create appointments on WP 8.x, all calendar apps are affected! Hard to believe but with WP10, MS in fact broke all existing calendar apps.

Does this also mean creating a calendar app is no longer possible in windows phone 10? I could not believe this and so I kept searching the SDK and as you can see from the screenshots of the app there are other methods.

  • Creating/Editing an appointment

The „ShowEditNewAppointmentAsync“ method Looks promissing, so let’s try this one.

var appointment = GetTestAppointment();
var result = await _appointmentStore.ShowEditNewAppointmentAsync(appointment);

When this method is called on the WP 8.x device (Lumia 630) and a new appointment is passed as method parameter, the dialog shown is identical to the one shown, when calling „ShowAddAppointmentAsync“.

Interestingly, when this method is called and an existing (!) appointment is passed, the same dialog for creating a new appointment is shown too. If you click on „Save“ you end up with 2 identical appointments.

Let’s see what happens when we call this method on our WM10 device.

In contrast to WP 8.1 the method behaves different and shows an UI that allows users to edit an appointment. Great, is this the solution for our broken calendar apps to allow editing appointments under WP10?

EditNewWP10_1 EditNewWP10_2

It might seems that a simple change of the called method fixes the problem that users can no longer edit appointment data but if you look closely, you will see that the dialog above is missing some important features: Settings an appointment status, setting a reminder and setting the appointment recurrence.

Please compare the screenshots above with the dialog that is shown when using the built in calendar.

Creating a new appointment in the built in calendar

Creating a new appointment in the built in calendar

As you can see the command in the built in calendar bar is very different. It shows the command bar for creating an appointment. In contrast when calling the method „ShowEditNewAppointmentAsync“ in the WinRT or UWP app, it shows the command bar for accepting/declining a Meeting!

I tried playing around with the properties of the passed appointment but could not find a solution.

So at the moment it’s not possible to create appointments with the full „edit experience“ for WM10, breaking all existing calendar apps and making it impossible for developers to create working apps that allow users to enter appointments.

Update: I tested this with the latest build of WM10, which is 10.0.10586.36. The problem still exists. 🙁

I will post this to the developer forum, maybe someone from MS knows some help.

Side note: While testing all of this another major problem occurred. When the built in calendar is started and you leave the app by pressing the windows button it „keeps running in the background“, meaning: It only get’s suspended, not terminated any further calls to „ShowAddAppointmentAsync“ or „ShowEditNewAppointmentAsync“ do not show any dialog – you simply get to see a blank, black screen!

Since the test app does nothing more than calling a method, provided by MS in my opinion the suspend/resume mechanism in the built in calendar was not implemented correctly by MS.

In my opinion there is a lot to do for MS to make WM10 more stable and fix these errors in the SDK. Changing the behavior of existing methods and thereby breaking all existing calendar apps was not what I expected from WP10.

Update: After some more search in developer forums, I found this thread: https://social.msdn.microsoft.com/Forums/Windowsapps/en-US/60c619eb-eaae-4431-84bb-c04321a91ea4/uwp-problems-in-appointment-apis?forum=wpdevelop

So this seems to be a known problem with the latest reply on this thread on september 13, and it was not fixed by MS before the official release. I don’t know what to say…I will post to this thread and wait for an answer from MS support.

Update: One thing was missing: Testing the UWP App Version on a PC on Windows 10 and that’s what I finally did.

UWP App Version running on a PC

UWP App Version running on a PC

As you can see, the full „edit experience“ is shown, when the app is running on windows 10 on the PC. Editing the appointment status, reminder time and recurrence is possible.

Exactly like it should be on windows phone 10 too.

 

 

 

 

 

3 Gedanken über “Porting Week View to UWP and some unexpected problems

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind mit * markiert.