ljhljh235
ljhljh235

Reputation: 51

Supporting WP8 while having extra features for WP8.1

I developed an app for Windows Phone 8 previously and now I'd like to add Windows.Security.Cryptography to my app, which is a new feature shipped with Windows Phone 8.1.

Problem appears after I finish developing on WP8.1. I can successfully build the app on WP8.1 with the cryptography features working. But the app never works on WP8 platforms any more (which is expected).

Is there a way that I can build one app that works on both WP8 and WP8.1, while on WP8.1 I can have extra support for new features?

Upvotes: 0

Views: 115

Answers (2)

yasen
yasen

Reputation: 3580

From what I understand, Windows.Security.Cryptography is available in Windows Phone Silverlight 8.1 apps. This means that you could use it in a WP 8.0 app through reflection. Something like this:

// Get the type object of the class that you want (I picked a random one, and it worked)
var engineType = Type.GetType("Windows.Security.Cryptography.Core.CryptographicEngine, Windows, Version=255.255.255.255, Culture=neutral, PublicKeyToken=null, ContentType=WindowsRuntime");

Once you have the type, you can instantiate it, invoke its methods and so on. You may try to instantiate the object and put it in a dynamic variable, so that you wouldn't need to manually reflect every method/property that you need. I haven't tested it with dynamic though, so it's just an idea. If you try it, please write a comment if it works or not.

So, you'll have just one WP 8.0 app and if it's deployed on a WP8.1 device, it will have access to some new features.

Upvotes: 1

Ertay Shashko
Ertay Shashko

Reputation: 1257

Unfortunately there is no way you can make that work. WP 8.1 can run 8.0 apps but it doesn't work the other way around. What you should do is submit the 8.1 package with the new features but also keep the 8.0 XAP (don't delete it) so people using Windows Phone 8.0 can still download your app, albeit without the extra 8.1 features.

Upvotes: 0

Related Questions