how to get windows phone 8 OS version using cpp - windows-phone-8

cpp has no namespace
System.Environment.OSVersion
so what's the api to get the OSVersion?
and system api GetVersion GetVersionEx seem not enabled in wp8

There is a lot missing when you go from Windows 8 to WP8. The only way I found to get all your problems solved is to call C# code from C++/CX. Here's how : Calling C# method from C++ code in WP8

Related

java.lang.UnsatisfiedLinkError: com.chrysalisits.crypto.LunaAPI.Initialize()V

I am getting below exception while running my application.
Caused by: java.lang.UnsatisfiedLinkError:
com.chrysalisits.crypto.LunaAPI.Initialize()V
at com.chrysalisits.crypto.LunaAPI.Initialize(Native Method)
at com.chrysalisits.crypto.LunaTokenManager.(LunaTokenManager.java:107)
at com.chrysalisits.crypto.LunaTokenManager.getInstance(LunaTokenManager.java:62)
I have added LunaProvider.jar and libLunaAPI in $JAVA_HOME/jre/lib/ext.
I strongly recommend that you ask the HSM Support Team for help on this instead of Stackoverflow.
This error comes up if Java is not able to find the concerned .so / .dll (Library) file. Also, make sure that you have the correct 32 / 64 Bit version of the Library in the location.
That said, in the VM Arguments you could also set :
-Djava.library.path=/location_to_the_libLunaAPI_so_file (possibly, /usr/lunasa/JSP/lib .. or something)
I have solved my problem.
Actual Problem was mismatch between native client library (libLunaAPI.so) and Luna client.
My application was using old library's com.chrysalisits.crypto.* classes to interact with Luna client however my Luna client got updated and functions which it exposed in its native library was not present in current library.
I updated my client application by using com.safenetinc.luna.* classes and latest client library.

JSON FX results not working for Xcode

I have an application that has extensively used server calls and i used jsonfx to parse the results and when i build the project from unity and run it on my mac it says
(Filename: currently not available on il2cpp Line: -1)
and application does not processed which is expected because my application depends extensively on responses from the api it hits.
Everything works swiftly on android.
i found out that Jsonfx is not compatible on ios platform an alternative for that is Newtonsoft.Json
simply put use this :
<T>Newtonsoft.Json.JsonConvert.DeserializeObject<T>(jsonString)
instead of JsonFx.Json.Reader
JsonFx.Json.JsonReader reader = new JsonFx.Json.JsonReader ();
<T>reader.Read<T> (jsonString);
offcourse you will nedd to add the following files to your code
NewtonsoftJson

how to lock the screen programmatically in windows phone 8?

We can prevent the screen to lock using the below code
PhoneApplicationService.Current.ApplicationIdleMode = IdleDetectionMode.Disabled
and
PhoneApplicationService.Current.UserIdleDetectionMode= IdleDetectionMode.Disabled
but how to lock the screen from my app. Like the below app
http://www.windowsphone.com/en-us/store/app/one-touch-lockscreen/a3b1220b-1f9a-4bf0-93bc-21ed02792279
Thanks in advance
It's pretty hacky. It's not in the official API, so it could stop working at any time, just like the volume control API. Anyway, it you want to do it, you need to use this external method:
[System.Runtime.InteropServices.DllImport("ShellChromeAPI.dll")]
private extern static void Shell_TurnScreenOn(bool value);
For WP8.0 app this needs to be in a Windows Runtime Component (you should reference its output, as the project cannot be referenced).
From what I understand, though, this won't work on WP8.1 devices, so you'll need a separate WP8.1 app and I think it needs to be a XAML (Windows Store) app.
What #yasen wrote is correct.
[DllImport("ShellChromeAPI.dll")]
private extern static void Shell_TurnScreenOn(bool value);
I've tried the following cases:
Runtime 8.1 C# (Passed store certification)
Runtime 8.1 C++ with Runtime Component 8.1 C# (Haven't tried to publish this in store)
Silverlight/DirectX 8.0 C++ (Passed store certification)
Here's the link to my app that's using the last solution mentioned above.
http://www.windowsphone.com/s?appid=38bf5918-025e-4f23-b515-2cac451a84ab
And I've heard about cases in store using Silverlight that supports 8.0 and 8.1.
You can get Screen is locked or not by Windows.Phone.System.SystemProtection.ScreenLocked
but Unfortunately There is no way to lock the screen via code in Windows Phone 7.x or 8.

How can i call unity3d functions from wp8 ui thread?

I tried many ways but nothing works fine. I am novice at programming and multuthreading operations is steel hard for me to understand.
In Windows Metro i can use:
Appcallbacks.instance.InvokeOnAppThread
How can i do it in wp8?
This work, but throw C++ exception, and i know that it's not right way
Deployment.Current.Dispatcher.BeginInvoke(()=>UnityApp.BeginInvoke(new UnityPlayer.Action(() => { my functions })));
Unity3d is not thread safe and you can't call it from any other thread, other than the main thread: http://answers.unity3d.com/questions/7524/is-the-unity-api-threadsafe.html
You must compile a native WP8 dll and invoke the Dispatcher from there. Make a static WP8 method with a callback that Unity code can use.

Windows Phone 8 app: using Platform Invoke

I'm trying to use Platform Invoke functionality in Windows Phone 8 application and getting NotSupportedException.
I'm doing something like this:
[System.Runtime.InteropServices.DllImport("PhoneDLL1.dll")]
public static extern void CallMeInC(int num);
....
CallMeInC(100);
Am I doing something wrong or this functionality is not supported for Windows Phone 8 apps ?
Thanks,
Rafi
Unfortunately, DllImport is not supported in Windows Phone. Currenty, the only workaround is to write a native component that mimics the behavior of DllImport and then referene that component from your managed code project.
more info here: Forum thread on MSDN
and here: Blog post on how to combine native code and managed code in Windows Phone