×

Discussion Board

Page 1 of 2 12 LastLast
Results 1 to 15 of 16
  1. #1
    Registered User
    Join Date
    Apr 2013
    Posts
    9

    Question WP7.x compatibility problem in WP8

    Hello;

    I have an App for WP 7.1 to access photos stored on the phone, so I have enabled capability "ID_CAP_MEDIALIB. When testing the application from Visual Studio in WP8 emulator is fine, but if I implement the XAP in emulator (or send it to certify) gives me error accessing the images.

    I've finally discovered that the problem is because in WP8 the capability ID_CAP_MEDIALIB_PHOTO it's needed.

    The question is, how can I add this capability to use in WP8, but at the same time I keep it running on WP7?. Because Apps for WP7.x must run on WP8 (at least I have not seen how exclusive for WP7.1)

    Thanks

  2. #2
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    552

    Re: WP7.x compatibility problem in WP8

    When running at WP7.1 app on WP8, all you have to worry about is making the app run perfectly on WP7.1 - then it should (99% of the time) work fine on WP8.

    New WP8 permissions don't apply to WP7.1 apps because they refer to features or changes that are not in WP7.1 SDK/APIs.

    If you're using the WP8 SDK with Visual Studio 2012, it does include WP7 emulators - test on those.

  3. #3
    Registered User
    Join Date
    Apr 2013
    Posts
    9

    Re: WP7.x compatibility problem in WP8

    First of all, thank you very much for your reply.

    The application is designed to WP7.1 with SDK 7.1 and it works perfectly, but when I send the marketplace is rejected because it fails on WP8.

    But how I can make it not fail?, Because to work in WP8 need a capability that does not exist in WP71.

    Does this mean that you can no longer publish WP71 applications accessing images stored?. I guess so, but how?.

    Thank you very much

  4. #4
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    552

    Re: WP7.x compatibility problem in WP8

    The only way to make your app work on WP8 is to test it - either via the emulator or with a real device. You should not develop a WP7.1, test it on a WP7 device then blindly submit it to the store hoping it will work on WP8.

    WP8 does run WP7.1 apps but it does so in 'quirks mode' which basically means there are some issues. Here is the full list...

    http://msdn.microsoft.com/en-us/libr...v=vs.105).aspx

    My advice would be to upgrade to Windows 8 Pro and get the Windows Phone 8 SDK and use that to develop and test. The WP8 SDK can be used to develop WP7.1 app only, if you like.

    I have two apps in the Windows Phone Store which are originally for WP7.1 (70%+ of users in my region have those devices) and I developer and maintain those with VS 2012 + WP8 SDK.

    Support for WP7.1 apps in the Store is likely to continue for at least a couple of years.

  5. #5
    Nokia Developer Champion
    Join Date
    Feb 2012
    Location
    Bilbao
    Posts
    53

    Re: WP7.x compatibility problem in WP8

    Hi Benito

    i talk with the windows phone product team and sadly they know about This issue and doesn't have a easy solution to it. What they propose is to create a wp8 Project and add as a link your wp7.1 Project files, so in the end you have only one codebase to mantain but can compile and publish two separate xaps, one for wp7.1 and one for wp8. This way each versión have the correct Capabilities.
    I know This isn't the best solution... but is the only one i can achieve to get...

  6. #6
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    552

    Re: WP7.x compatibility problem in WP8

    Quote Originally Posted by josueyeray View Post
    i talk with the windows phone product team and sadly they know about This issue and doesn't have a easy solution to it. What they propose is to create a wp8 Project and add as a link your wp7.1 Project files, so in the end you have only one codebase to maintain but can compile and publish two separate xaps, one for wp7.1 and one for wp8. This way each versión have the correct Capabilities.
    I know This isn't the best solution... but is the only one i can achieve to get...
    So are you saying that it's a known issue with that particular capability?

  7. #7
    Nokia Developer Champion
    Join Date
    Jul 2012
    Posts
    88

    Re: WP7.x compatibility problem in WP8

    Actually yes, as the matter of fact, ID_CAP_MEDIALIB were deprecated in WP8 , now you have to specify exactly what you need : ID_CAP_MEDIALIB_PHOTO , ID_CAP_MEDIALIB_VIDEO , ID_CAP_MEDIALIB_AUDIO (ID_CAP_MEDIALIB_PHOTO in your situation)
    All I can think of is to create a WP8 version of your app as josueyeray said , and publish two separate xaps.

  8. #8
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    552

    Re: WP7.x compatibility problem in WP8

    Quote Originally Posted by WPMorocco View Post
    Actually yes, as the matter of fact, ID_CAP_MEDIALIB were deprecated in WP8 , now you have to specify exactly what you need : ID_CAP_MEDIALIB_PHOTO , ID_CAP_MEDIALIB_VIDEO , ID_CAP_MEDIALIB_AUDIO (ID_CAP_MEDIALIB_PHOTO in your situation)
    All I can think of is to create a WP8 version of your app as josueyeray said , and publish two separate xaps.
    I understand that some capabilities have changed between WP7.1 and WP8 - as have some APIs. But if an app was created that targets WP7.1 that uses the ID_CAP_MEDIALIB, does that throw an exception or other issue when running on WP8?

    http://msdn.microsoft.com/en-us/libr...v=vs.105).aspx

  9. #9
    Registered User
    Join Date
    Apr 2013
    Posts
    9

    Re: WP7.x compatibility problem in WP8

    Quote Originally Posted by theothernt View Post
    I understand that some capabilities have changed between WP7.1 and WP8 - as have some APIs. But if an app was created that targets WP7.1 that uses the ID_CAP_MEDIALIB, does that throw an exception or other issue when running on WP8?

    http://msdn.microsoft.com/en-us/libr...v=vs.105).aspx
    Yes, I've heard a few days ago. When testing my app certified for WP7.1 in WP8 fails.

    Additionally I followed suggested by Yeray, but for now it still fails in the same, however I have to check out the app, I did it very fast and maybe I did something wrong.

    Thank you very much everyone for your responses.

    regards
    E.Benito

  10. #10
    Registered User
    Join Date
    Apr 2013
    Posts
    9

    Re: WP7.x compatibility problem in WP8

    Thank you very much Josué and the others for your reply.

    I was trying your solution, but still fails.

    It is very rare.:

    Works fine when:
    1 -. Run from Visual Studio (Debug and Release)
    2 -. I run the version installed on the emulator, but only when it's built as debug

    Fails when
    1 -. I run the installed version, when it was built as release
    2 -. Install the XAP with Deploiment Application tool


    I just try with a new WP8 proyect and a reduced code, but the same error occurs. I was testing this code:

    try
    {
    PictureAlbum AlbumOrigen = null;
    foreach (MediaSource source in MediaSource.GetAvailableMediaSources())
    {
    if (source.MediaSourceType == MediaSourceType.LocalDevice)
    {
    var mediaLibrary = new MediaLibrary(source);
    PictureAlbumCollection allAlbums = mediaLibrary.RootPictureAlbum.Albums;
    foreach (PictureAlbum album in allAlbums)
    {
    if (album.Name == "Saved Pictures")
    {
    AlbumOrigen = album;
    Picture p = AlbumOrigen.Pictures.FirstOrDefault();
    BitmapImage bmp = new BitmapImage();
    bmp.SetSource(p.GetImage());
    photoImage.Source = bmp;
    }
    }
    }
    }
    }
    catch (Exception ex)
    {
    MessageBox.Show("Ocurrió un problema accediendo al álbum: Saved Pictures" + "\r\n" + ex.Message, "Advertencia", MessageBoxButton.OK);
    }

    The error it's : "An expected error has ocurred".

    What's wrong with that code so simple?


    Thank you very much for your support

  11. #11
    Nokia Developer Moderator
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    28,692

    Re: WP7.x compatibility problem in WP8

    Try with Exception.ToString too.

  12. #12
    Registered User
    Join Date
    Apr 2013
    Posts
    9

    Re: WP7.x compatibility problem in WP8

    Quote Originally Posted by wizard_hu_ View Post
    Try with Exception.ToString too.
    This it's the complete exception:

    System.InvalidOperationException: An unexpected error has occurred.
    at Microsoft.Xna.Framework.Media.MediaLibraryEnumerator`1.get_Item(Int32 index)
    at Microsoft.Xna.Framework.Media.MediaLibraryEnumerator`1.System.Collections.IEnumerator.get_Current()
    at Microsoft.Xna.Framework.Media.MediaLibraryEnumerator`1.System.Collections.Generic.IEnumerator<T>.get_Current()
    at PhotoSnap.MainPage.Button_Click(Object sender, RoutedEventArgs e)


    Surely the error occurs in MediaSource.GetAvailableMediaSources()

    But on Debug mode works well

    Thanks
    Last edited by jebenito; 2013-07-22 at 10:40. Reason: Complete data

  13. #13
    Nokia Developer Champion
    Join Date
    Feb 2013
    Location
    Dublin, Ireland
    Posts
    552

    Re: WP7.x compatibility problem in WP8

    This looks problematic to me...

    Code:
    Picture p = AlbumOrigen.Pictures.FirstOrDefault();
    p can either be the First() item or null, but you don't check for that later on so the following can crash your app...

    Code:
    bmp.SetSource(p.GetImage());
    At the very least, put a Try() Catch {} around it, and display the Exception details.

  14. #14
    Nokia Developer Champion
    Join Date
    Feb 2012
    Location
    Bilbao
    Posts
    53

    Re: WP7.x compatibility problem in WP8

    Hi theothernt, jebenito

    Althrought that code seems problematic... it crash with a NullReferenceException, not an InvalidOperationException. (you need to control that the Picture is not null before using it as source, but i think This isn't the problem here...)

    jebenito, i test your code in a simple wp8 app, adding to the Capabilities ID_CAP_MEDIALIB_PHOTO and it Works fine for me, getting the first picture of an álbum and showing it on an image control... I upload my Project to Skydrive so you can test it: http://sdrv.ms/16WlEFQ

    Have a nice day!

  15. #15
    Registered User
    Join Date
    Apr 2013
    Posts
    9

    Re: WP7.x compatibility problem in WP8

    Thank josueyeray for your demo

    But fails sometimes when I run the XAP without Visual Studio.

    I made a few changes in your project to see where it fails, and on some occasions it does at the beginning (in: if ((album != null) && (album.Name == "Saved Pictures")) )and others at the end (after executio of: photoImage.Source = bmp; ) of the code.

    Attached here the changes made: http://sdrv.ms/1bIF3B3

Similar Threads

  1. Compatibility problem
    By sujithkannan in forum [Archived] Qt Mobility Project
    Replies: 1
    Last Post: 2011-04-27, 05:53
  2. Compatibility Problem
    By deny_winarto in forum Mobile Java General
    Replies: 19
    Last Post: 2009-09-05, 10:57
  3. Is S60 Forward-Compatibility or Backward-Compatibility?
    By bjtuchen in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2009-03-18, 06:59
  4. compatibility problem
    By silviuccia in forum Symbian
    Replies: 3
    Last Post: 2007-03-09, 08:33
  5. UK compatibility problem with 7250 and 5.1 pc suite
    By MrIzzard in forum PC Suite API and PC Connectivity SDK
    Replies: 3
    Last Post: 2003-05-20, 18:11

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×