I have been trying to create a UWP class library that gives me access to Windows 10s native features such as Windows.Security.Authentication.OnlineId. I would like to get a username and ID from the device for use in a Unity UWP IL2CPP project. I am currently able to do this with Unity's built in social class for ios and there is code which google has written that allows this to work seamlessly with the same class but for android's Google Play Games.
I've downloaded a sample off github (https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/WebAccountManagement) which demonstrates how to call the relevant classes and functions in a UWP app and works well but the samples appear to be are accessing classes from the "Windows.Foundation.UniversalApiContract" class.
I can't seem to find a way to add this to a basic UWP class library so I can call on the required classes such as Windows::Security::Credentials::WebAccountProvider.
The best I've been able to do is create a basic function in the class library that returns a small hardcoded string just to test if the concept was remotely possible. :-
extern "C" __declspec(dllexport) wchar_t* __stdcall GetMyString()
{
wchar_t* myString = L"Guuuper";
auto resultBufferLength = wcslen(myString) + 1;
wchar_t* result = static_cast<wchar_t*>(CoTaskMemAlloc(resultBufferLength * sizeof(wchar_t)));
wcscpy_s(result, resultBufferLength, myString);
return result;
}
My whole journey in attempting to do that can be found here:- http://forum.unity3d.com/threads/returning-c-string-to-il2cpp-windows-store-project.395284/
I've been able to successfully call this code from within unity via a UWP build but my main question is how I would go about adding the appropriate references or how I would create this class library to access the WebAccountProvider class?
Any help would be much appreciated
Update: I have asked the MS team at their own site about this challenge and they appear to be working on a solution.