sobota, 5 stycznia 2013

Z dokumentacji WP8 (3)

Ostatnia porcja ciekawostek wyłowionych przeze mnie z dokumentacji Windows Phone. Jak się okazuje mimo quirk mode jest całkiem możliwe, że aplikacja WP 7.1 i zachowa się nieco inaczej na WP 8, co w niektórych przypadkach może spowodować, że może się nawet nie uruchomić. Na szczęście są to dość wysublimowane i rzadkie przypadki. Znalazłem też jeden nienagłaśniany fakt, który może ucieszyć właścicieli telefonów z WP 7.x. WP8 nie wspiera radia FM! (przynajmniej na razie). Mamy też klarowne rozliczenie się pomiędzy WinPRT a WinRT, część wspólna to ok 25%. Na koniec tego posta dodałem kilka uzupełniających linków z oficjalnego Windows Phone Developer Blog. Znajdziemy tam m.in opis Windows Phone Toolkit, wskazówki jak skorzystać z nowych możliwości kafli w Windows Phone 7.8 (wpis w manifeście + mało eleganckie wykorzystanie refleksji) i jak wykryć tryb Kid’s Corner.

Koncepcje & architektura

You cannot use the new Simulation Dashboard for apps that target Windows Phone OS 7.1.

App platform compatibility for Windows Phone

A third-party library that is developed for Windows Phone OS 7.1 takes advantage of quirks if it is used in a Windows Phone OS 7.1 app. However, if the library is used in a Windows Phone 8 app, it runs outside of quirks mode.

Breaking changes (mimo kompatybilnościowego trybu quirks)

Windows Phone-specific features

  • Back button navigation: app + ad
  • Background file transfer:
    • WP7.1: do 5 transferów, WP8: do 25 transferów
    • WP8: dla aplikacji w foreground transfery w tle przy sieciach: 2G, EDGE, Standard, GPRS (nie można tego obejść własnym rozwiązaniem)
    • WP 7.1 i 8: transfer w tle niezależny od bycia w foreground dla sieci >= 3G
  • Choosers: brak wyjątku przy drugim Show() podczas nawigacji do choosera
  • DRM:  an app cannot properly consume DRM video as a texture; the video defaults to a black display. In Windows Phone OS 7.1 and earlier versions, DRM protected video is accessible as a texture for composition
  • FM Radio:  Windows Phone 8 does not support the FM radio feature. If you use the FM radio API in a Windows Phone 8 app, a RadioDisabledException will occur.
  • Local database:  In Windows Phone 8, you can no longer access a local database in isolated storage using a read-only connection string, unless you are accessing the installation folder.
  • MessageBox
  • Microsoft.Phone.Media.Extended assembly:  The Microsoft.Phone.Media.Extended assembly that shipped in-ROM on Windows Phone OS 7.1 phone devices is not available on a Windows Phone 8 phone (to nie było publicznie dostępne API, można było korzystać przez refleksję)
  • Networking:  In Windows Phone 8, because the Windows Phone 8 client can handle the Vary header and cache responses, a Web service call may complete much faster than in previous versions.
  • Photo chooser task:  In Windows Phone 8, the photo chooser task creates a directory in the top level of the app’s isolated storage called “PlatformData”.
  • Slider control - zmiany w template parts!
  • TextBox control - not a multi-line TextBox: In apps that target Windows Phone OS 7.1, the TextInput event is raised for Enter key presses that are not handled by the TextBox. In apps that target Windows Phone 8, the TextInput event is not raised for these Enter key presses.
  • Tiles - In Windows Phone 8, creating a Tile by using the Create(Uri, ShellTileData) method inside the Closing handler will throw an InvalidOperationException.
  • UIElement text input events: The TextInput, TextInputStart, and TextInputUpdate events do not occur in Windows Phone 8 and they did occur in Windows Phone OS 7.1. (należy używać zdarzenia KeyDown)
  • VibrateController controller: In Windows Phone OS 7.1, if you called the Stop() method of the VibrateController without previously calling its Start(TimeSpan) method, all vibrations were canceled, including those started by other apps such as the phone or a toast notification. In Windows Phone 8, if you call the Stop() method of the VibrateController without previously calling its Start(TimeSpan) method, nothing happens. No exception is raised.
  • Video play back:  On Windows Phone 8, resuming video play back after locking and then unlocking the phone has changed. On Windows Phone OS 7.1, the video opens in the paused state and the image is visible. On Windows Phone 8, the video opens in the paused state but an empty black box is displayed in place of a frame from the paused video. In both cases, the user has to click Play to resume the video.
  • WebBrowser control: 
    • The UserAgent string associated with the web browser control has changed slightly between Windows Phone OS 7.1 and Windows Phone 8.
    • Control has several changes that affect how content displays in an app (text, bullet items, and drop-down arrows)
    • Using the ScriptNotify method of the Window.External object to call OnContextMenu is not supported in Windows Phone 8. (do pokazania kontekstowego menu należy teraz używać zdarzenia OnMSGestureHold)
  • XNA:
    • Due to changes in when the Game.IsActive property is set, a game may not resume as expected.
    • In Windows Phone 8, the following render formats are not supported.
      • SurfaceFormat.Bgra4444

      • SurfaceFormat.Bgra5551

CLR

  • Finalization - Windows Phone 8 includes a completely different garbage collector than Windows Phone OS 7.1.
  • Floating-point comparisons  - Because of differences in rounding behavior in Windows Phone OS 7.1 and Windows Phone 8, floating point values may differ. This is especially true when performing equality comparisons with a constant and the result of a floating point computation.
  • Support for loading multi-module assemblies - In Windows Phone OS 7.1, the common language runtime loads multi-module assemblies; in Windows Phone 8, it does not.
  • Support for adding mixed-mode assemblies (assemblies that target the desktop version of the .NET Framework) - In Windows Phone OS 7.1, apps with mixed-mode binaries that are not loaded execute successfully; in Windows Phone 8, they do not.
  • Threading (the .NET thread pool, .NET thread scheduling policy, operating system scheduling policy) - In Windows Phone OS 7.1, apps run on a single core, and the scheduler is less aggressive in time-slicing threads in the single core. In Windows Phone 8, applications can run on multiple cores and the scheduler is more aggressive in time-slicing threads (mogą częściej występować błędy z wątkami, wyścigi itp)
  • Common Intermediate Language (CIL) method size - In Windows Phone 8, there is a 256-KB limit on the size of a method's CIL.
  • Access to private nested classes - Windows Phone OS 7.1 allows a class to access its private nested classes; Windows Phone 8 does not.
  • Instance field reads and writes - Instance field reads are optimized by the JIT compiler.
  • Platform invoke marshaling - In Windows Phone OS 7.1, strings are marshaled as Unicode by default; in Windows Phone 8, they are marshaled as ANSI by default.

.NET

  • dużo szczegółowo dobranych przypadków
  • inne kody hash
  • inne kolejności
  • zmiany w serializacji XML

Tryb Quirk w CLR i .NET

  • zapewnienie logiki JIT z poprzedniego systemu
  • ładowanie x86 na procesorach ARM
  • obsługa zduplikowanych definicji generowanych przez obfuskatory

Native code on Windows Phone 8

Windows Phone 8 supports Visual C++ 2012. This is the full version of C++ that is available on the desktop, and the two versions use the same compiler and IDE. This means that your phone app can reuse existing C and C++ libraries that you have developed for other platforms, in addition to third-party libraries and middleware.

Windows Phone 8 supports a limited set of COM and Win32 APIs that are available on the desktop.

Company app distribution for Windows Phone

In Windows Phone 8, the list of root certificates is identical to and automatically synced with the root certificates supported by Windows 8. For the full list of supported Windows Phone 8 root certificates, see Windows and Windows Phone 8 SSL Root Certificates.

Typically Windows Phone 8 apps start very quickly and a splash screen is not necessary.

App memory limits for Windows Phone 8

Web development for Windows Phone

  • pewne różnice między desktopowym IE 10 a IE for Windows Phone OS 8.0
  • pewne różnice w pozycjonowaniu CSS w stosunku do IE z WP 7.1

 

Windows Phone API

.NET API

The .NET API contains classes and types from the System and Microsoft.Phone namespaces. We’ve added functionality for Windows Phone 8, including Microsoft.Phone.Wallet, the ShareMediaTask, Lock screen for Windows Phone 8 enhancements and lots, lots more.

Windows Phone Runtime API

IC619080

  1. The set of Windows Runtime API not supported on Windows Phone 8. The API surface area of Windows Runtime is very large, with over 11,000 members. We’ve adopted a subset for Windows Phone 8 that allows you to build compelling phone scenarios.
  2. The set of Windows Runtime API adopted for Windows Phone 8. This is represented by area 2 in the above diagram and consists of approximately 2,800 members. For some types, we have not implemented certain members. For others we have added additional members to support phone-only features.
  3. We’ve added key APIs needed to build great apps for the phone. These are represented by area 3 in the diagram and total about 600 members. For example, we have brand-new APIs for speech synthesis and recognition, VOIP, and other features.

W dokumentacji WinRT API wspierane elementy w WP8 w Requirements posiadają sekcję “Minimum supported phone”. Cześć API może być widoczna, ale nie została zaimplementowana na WP8. IntelliSense w Visual Studio informuje nas o tym.

Win32 and COM API for Windows Phone

In addition to these APIs, you have access to some Win32 APIs that give you access to low-level features of the platform. This includes Winsock API for low-level networking.

Camera APIs for native code (Windows Phone 8)

 

Linki

http://blogs.windows.com/windows_phone/b/wpdev/archive/2012/11/08/internet-explorer-10-brings-html5-to-windows-phone-8-in-a-big-way.aspx

Internet Explorer 10 for Windows Phone does not support the following:    

  • Inline video
  • Some of the new manipulation views APIs  for touch panning and zooming, with the exception of –ms-touch-action
  • Multi-track HTML5 audio (simultaneous)
  • ActiveX and VBScript
  • Drag-and-drop APIs
  • File access APIs with the exception of blobs which are supported on Windows Phone 8
  • Windows 8 integration features: Link previews, pinned site icons & notifications and support for connecting sites to apps
  • Also in Internet Explorer 10 for Windows Phone, Window.open does not return a valid window object. This is because on the phone each “window” is isolated in its own sandbox.

http://blogs.windows.com/windows_phone/b/wpdev/archive/2012/11/20/windows-phone-toolkit-overview.aspx

http://blogs.windows.com/windows_phone/b/wpdev/archive/2012/11/28/increase-your-app-reach-with-windows-phone-7-8.aspx

To support the new Tile sizes and templates, in your code check if the app is running on Windows Phone 7.8 ( TargetedVersion = new Version(7, 10,8858)). Then if this condition is true, enable the new Tile updates following the guidance in the article Adding Windows Phone 8 Tile functionality to Windows Phone OS 7.1 apps.

http://blogs.windows.com/windows_phone/b/wpdev/archive/2013/01/04/how-to-detect-that-your-app-is-running-in-kid-s-corner.aspx

Enter the ApplicationProfile class, and its single static Modes property. If the current mode is Alternate, that means your app is running in Kid’s Corner.

1 komentarz:

Mateusz Kierepka pisze...

Gratuluje detektywistycznej pracy ;)