I'm developing a game for Windows Phone 7.1 with XNA framework.
I know there is a way to prevent piracy for Windows Phone 7 (and 8.0, 8.1) - checking if the file "WMAppPRHeader.xml" exists in app directory.
I'm using this code:
try
{
Stream stream = TitleContainer.OpenStream("WPAppPRHeader.xml");
if (stream.CanRead)
{
stream.ReadByte();
stream.Close();
}
}
catch
{
//file read error, it means it was hacked
}
When use this code and upload my game to Windows phone marketplace as a "Beta" app, it works great. File "WPAppPRHeader.xml" is readable from my game and the test is passed.
But, when upload the same XAP in Windows Phone marketplace as a public app, this code fails and my game thinks that it was hacked (I'm checking this somewhere in the middle, so microsoft testers doesn't event recognise that something is wrong and my game succesfuly passes certification).
So, what am I doing wrong? Why the same code, the same XAP is working when it's Beta, and not working when it's Public?
I still don't know why TitleContainer.OpenStream is working in beta and not working in public market, but here is the code, that works in public market:
System.Xml.Linq.XDocument.Load("WPAppPRHeader.xml");
Related
Is there any way to know the game is running in an emulator application or a real device ?
Some Applications like VirtualXposed are virtual emulator for android devices. Such Applications allow users to install a game / application multiple times on their device with different identifies.
I want to know is there any way to recognize my game / application is running in emulator or a physical device in unity3d ?
something like :
if(isemulator)
{
dosomething();
}
It's not easy to do since there are many emulators out there. The answer from this post says that you can use Build.FINGERPRINT.contains("generic") to do that.
You can port the Java code to C# in Unity with the AndroidJavaClass class and without building Java plugin. Below is the ported version in C#:
public bool IsEmulator()
{
AndroidJavaClass osBuild;
osBuild = new AndroidJavaClass("android.os.Build");
string fingerPrint = osBuild.GetStatic<string>("FINGERPRINT");
return fingerPrint.Contains("generic");
}
To make sure that this covers most emulator, use the android-emulator-detector plugin. This plugin seems to be rigorously tested and detects most emulators. You can use AndroidJavaClass to communicate with it and UnityPlayer.UnitySendMessage to make callback into your Unity code in C#.
Maybe you can look for some emulator specific SystemInfos (Unity Docs SystemInfo) eg. SystemInfo.deviceModel
my app (developed in Windows Phone 8.1 RT environment) uses OpenFilePicker which allows me to choose image and capture an image, it works great however when I deployed this app on a Windows 10 device, this function just allowed me to pick an image from the library. I thought about a solution, writing a small code block which can help me to detect the version of the OS like this
#if WINDOWS_PHONE_APP
//codes
#endif
But I don't know exactly what I need to do, so please help me!
Read this link:
Windows Store Apps: Get OS Version, beginners tutorials (C#-XAML)
it purpose a simple solution to check is OS has Windows 10 features with reflection:
var analyticsInfoType = Type.GetType("Windows.System.Profile.AnalyticsInfo, Windows, ContentType=WindowsRuntime");
var versionInfoType = Type.GetType("Windows.System.Profile.AnalyticsVersionInfo, Windows, ContentType=WindowsRuntime");
if (analyticsInfoType == null || versionInfoType == null)
{
// That's not Windows 10
}
I am new to windows phone app development. I am trying to build a simple speech recognition app using SpeechRecognizerUI class. But the problem is whenever i try to debug the app in my Lumia 520 device(working on 8.1 platform), it load the listener as usual and then debugger stopped automatically at the same time it load within a second, don't allow me sufficient time to speak even a single word. I am googling since 2 days but got nothing helpful. I have provided a single button on "MainPage.xml" of my app for which i have given the following code.
namespace Kundali
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
}
private async void button_Click(object sender, RoutedEventArgs e)
{
![SpeechRecognizerUI][1] sprec = new SpeechRecognizerUI();
SpeechRecognitionUIResult result = await sprec.RecognizeWithUIAsync();
MessageBox.Show(string.Format("You said {0} ", result.RecognitionResult.Text));
}
}
When i tried to handle the exception in catch handler it shows the exception "The text associated with this error code could not be found" not even listening the single text. Some one please help me.
Actually i am working with Visual studio 2012 (Express for windows Phone 8) but my device is on 8.1. Is this the problem?? If yes then please provide the solution. How do i integrate the functionality of 8.1 in vs2012?
I can think of two possible causes:
Did you add the Speech capability and the Microphone capability in your manifest WMAppManifest.xml file?
Do you have speech support for your current language? (Try setting to en-US to test)
Did you try using TTS (Text to Speech) which is also compatible with Windows Phone 8.1?
Sample
Windows Phone 8.1 Text to Speech
My application have a small piece of code which read/write a file in C++/CX (Windows Phone 8 Interop DirectX) like this:
bool WriteState(char *fileName) {
FILE *fp = fopen(fileName);
if (fp) {
// Do save
...
fclose(fp);
return true;
}
return false;
}
and ReadState has the same code. and invoking (call from C#):
ObjectClass game = new ObjectClass();
game.WriteState("game1.state");
It's no problem when I run on my device, debug with no error. But after I published to Windows Phone Store and install to my device, the Read/Write code doesn't work. Why this happen?
Make sure you aren't saving the file in its install location. Your app won't have access to its install location in production. You'll need to save in isolated storage.
http://msdn.microsoft.com/en-us/library/windows/apps/jj681698(v=vs.105).aspx
There is this way, that should work for you..
I recently installed the Windows Phone 8.1 emulators to try some existing apps out on them and ran into this problem: DeviceNetworkInformation.IsCellularDataEnabled (in the Microsoft.Phone.Net.NetworkInformation namespace) is always returning false.
public void UpdateDataEnabled()
{
_dataEnabled = DeviceNetworkInformation.IsCellularDataEnabled
|| DeviceNetworkInformation.IsWiFiEnabled;
}
I know the connection is actually working because I'm still able to perform HTTP requests. If I run this same exact code in the 8.0.x emulators I don't have any problems.
I also tried updating the project and all libraries to Windows Phone Silverlight 8.1 apps to see if that would resolve the issue and no luck. I checked all the capabilities and ID_CAP_NETWORKING was still checked as well.
The emulator is tested and working if I write a pure Windows Phone 8.1 XAML app using Windows 8 method of obtaining network status. It's just not working for my Silverlight apps.
I was under the impression that Windows Phone Silverlight apps should continue to function on Windows Phone 8.1 devices. Am I overlooking something?
I have the same problem and i did what verdesrobert and Rishabh876 suggested. Its only emulator problem so i add condition to check out if app is running on emulator
public bool IsNetworkAvailable()
{
if (DeviceNetworkInformation.IsNetworkAvailable)
{
if (Microsoft.Devices.Environment.DeviceType == DeviceType.Emulator)
{
return true;
}
else if ((DeviceNetworkInformation.IsWiFiEnabled || DeviceNetworkInformation.IsCellularDataEnabled) && NetworkInterface.NetworkInterfaceType != NetworkInterfaceType.None)
{
return true;
}
}
return false;
}
I dont like that workaround much so if anyone has better solution let me know.
It seems that the WP8.1 emulator is giving that information only to WP8.1 apps.
I'm pretty sure that the 7.1 apps will work properly on WP8.1 Devices.