How to simulate Trial mode on Windows Phone 8 app? - windows-phone

I've been developing and testing WP apps for more than year, including paid apps with trial versions, Silverlight and XNA too. When using Guide.SimulateTrialMode and Guide.IsTrial in WP7 SDK, it was perfectly working in emulator and on real device as well. Now when I use this same approach in WP8 SDK for WP8 apps, when I set SimulateTrialMode to true, then Guide.IsTrial still returns false. I've even tried LicenseInformation.IsTrial() and it is returning false as well.
The question is, am I doing something wrong, or it is no longer possible to simulate the trial mode using Guide.SimulateTrialMode in WP8 apps? Note when I use this for WP7.1 apps with WP8 SDK, it works just fine, so I guess it's only bug in WP8 apps.
I've checked these guides, but there is no hint that SimulateTrialMode is broken on WP8:
Creating trial apps for Windows Phone
Guide.SimulateTrialMode Property
App platform compatibility for Windows Phone
tl;dr SimulateTrialMode is not working in WP8 apps, any other way, how to simulate Trial mode?

The way I do it is, instead of calling directly Guide.IsTrialMode, I wrap it in a property:
public static bool IsTrial
{
get
{
return Guide.IsTrialMode;
}
}
The point is that you can now easily change the property to return true or false during your test. You can even use preprocessor directives and a specific build configuration to switch to trial mode:
public static bool IsTrial
{
get
{
#if TRIAL
return true;
#else
return Guide.IsTrialMode;
#endif
}
}

Related

Problem adding "pro mode" for Huawei Camera Kit

I followed the sample code on their developer page, and I'm not sure how to add the pro mode camera feature into my app after initializing the Huawei Camera Kit instance.
private CameraKit mCameraKit;
mCameraKit = CameraKit.getInstance(getApplicationContext());
//If the current mobile phone does not support the kit or the SDK version is incompatible, NULL is returned. Compatibility processing is required.
if (mCameraKit == null) {
return;
}
Based on the Huawei Developer guides section, pro mode should be one of the supported camera modes, but I did not find pro mode in the Camera Kit API reference. Does anyone know how to enable pro mode?
There is no specific mode definition for Pro mode. Pro mode is defined by the open keys. You only need to:
Set mCurrentModeType to PRO_PHOTO_MODE or PRO_VIDEO_MODE.
Use mCurrentModeType to create a Mode object.
Call the setParameter method of the Mode object to enable the corresponding capability.
Use the takePicture, startRecording, and stopRecording methods of the Mode object to take photos and record videos. Refer to details.
After the preview function is enabled, you can configure the capability values of Pro mode, such as the ISO, exposure time, and white balance. Below are some sample code.
// Query the functions supported by the mode.
List<CaptureRequest.Key<?>> parameters = mModeCharacteristics.getSupportedParameters();
// Query the supported ISO range.
List<Integer> values = mModeCharacteristics.getParameterRange(RequestKey.HW_PRO_SENSOR_ISO_VALUE);
// Set the ISO value. The first value is used as an example.
mMode.setParameter(RequestKey.HW_ PRO_SENSOR_ISO_VALUE, values.get(0));
Currently, Pro Mode is supported only on devices with Kirin 990 and Kirin 9000.
The following code is provided for your reference on how to add a mode to your app. Currently, only the rear camera supports Pro Mode.
// Query the camera list of the device.
String[] cameraLists = mCameraKit.getCameraIdList();
// Query the modes supported by the current camera.
int[] modes = mCameraKit.getSupportedModes(cameraLists[0]);
// Create a mode.
mCameraKit.createMode(cameraLists[0], mCurrentModeType, mModeStateCallback, mCameraKitHandler);

How do I detect that the Windows Mobile transitioned to continuum mode?

Is there a way to detect that Windows Mobile 10 transitioned into continuum mode?
The message-box on Windows Phone does not look anything like the one on Desktop and our designers want parity. I want to write our own version, but I only want it to work on Phone - I want the default one on desktop or when the app transitions to continuum on phone.
Any ideas?
I could not find anything on the web nor find any API that allows me to detect it.
I may be wrong but I don't think there is an API for Continuum. The idea of Continuum for Phone is that you're going from a fixed display size to something that is variable. The best way to detect this would be using the Visual State Triggers or checking if the size of the window has changed.
By also checking that the device family, AnalyticsInfo.VersionInfo.DeviceFamily, is Windows.Mobile, you'll know that you're using a phone device which is currently in the Continuum mode.
To detect if app is running in Continuum mode you'll need to check two things: DeviceFamily and UserInteractionMode.
public static bool IsInContinuum()
{
if (DeviceFamily() == DeviceFamilyType.Mobile && UIViewSettings.GetForCurrentView().UserInteractionMode == UserInteractionMode.Mouse)
return true;
else
return false;
}
Quote from this post:
"With Continuum, “touch” will always be returned when your app is on the mobile device, and “mouse” will always be returned when your app is on the connected display."
So you'll need to check if app runs in Continuum in SizeChanged event.
Due to MSDN Documentation Below,
There's no spesific trigger for Windows 10 Mobile continuum feature detection.
Continuum for Universal Apps
In order to find a solution on Mobile Apps, you can benefit from adaptive UI, you can check the app via screen resolution change Window.Current.SizeChanged, then you can combine with Device family AnalyticsInfo.VersionInfo.DeviceFamily to check if device is in Continuum mode.

Windows Phone 8.1 VB App PhoneApplicationService

I have already made an windows phone app in VB to play music.
Now i want this app to work even while lookscreen.
Searching for the answer, i only found codes like this (in C#):
PhoneApplicationService.Current.ApplicationIdleDetectionMode = IdleDetectionMode.Disabled;
PhoneApplicationService is from the namespace: Microsoft.Phone.Shell
So i tryied to import this namespace,to disable the ApplicationIdleDetectionMode , but it doesnt seem to exist.
So my question is: what i am doing wrong? if my xaml-app does not support the namespace at all, how do i work arround this problem?

Worklight persistent busy indicator

I'm working on a project using IBM Worklight and any time I build and deploy my project on any simulator or device, I have this busy indicator spinner in the middle of the screen. Its always there, on every page and its there in the ios, windows, web and android simulators as well as one android device we've tested on. Has anyone seen this before and if so how would I get rid of it.
Jquery-mobile was the problem, it was continuously displaying the indicator for seemingly no good reason. Deleting Jquery mobile fixed the problem
I already used the native worklight loading.It is very good and I tested it on different platforms, devices. But it is necessary to close it when you leave the function that opened it.
Example:
var busyInd = new WL.BusyIndicator ("content", {text: "Please wait..."});
function consult(){
busyInd.show();
//impl
busyInd.hide();
}

What happened to FM Radio in Windows Phone 8?

FM Radio was a mandatory HW requirement in Windows Phone 7, but it's not present on any current Windows Phone 8 device.
Why there is no FM radio in Music Hub in WP8? Can we at least use the FMRadio API?
According to MSDN:
http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj206947(v=vs.105).aspx
Windows Phone 8 does not support the FM radio feature. If you use the
FM radio API in a Windows Phone 8 app, a RadioDisabledException will
occur.
Also from what I heard:
...the FM radio feature was planned to be included but got cut from this
release due to stability vs. time constraints.
(... I don't know if
there are any plans to re-enable this feature in a future update.)
You can use this test to safely determine if FMRadio can be used on current phone:
/// <summary>
/// Flag is radio device is available in this phone.
/// </summary>
public bool IsRadioAvailable
{
get
{
if (!radioInitialized)
{
radioInitialized = true;
try
{
radio = FMRadio.Instance;
isRadioAvailable = true;
}
catch (RadioDisabledException e)
{
isRadioAvailable = false;
}
}
return isRadioAvailable;
}
}
private bool radioInitialized;
private bool isRadioAvailable;
private FMRadio radio;
Update:
According to various sources FM radio will be enabled in upcoming Windows Phone 8 update that should arrive in Summer 2013.
I read that the Lumia 920 has FMRX and just needs to be "utilised". Not sure if they helps in any way
FM Radio returns, on supported hardware, in Windows Phone 8 'GDR2' (8.0.10327.77/78).
It's not clear whether the API support also returns and how it behaves:
Caution:
FM radio is supported only in apps that target Windows Phone OS 7.1.
If you use the FMRadio class in apps that target Windows Phone OS 8.0
or later, a RadioDisabledException indicates that the FM radio feature
is not available. On Windows Phone 8 devices with a build of 8.0.10322
or greater, the run-time exception may not occur if you use the
FMRadio API. However, the FMRadio API is not supported for apps that
target Windows Phone OS 8.0.
http://msdn.microsoft.com/en-us/library/windowsphone/develop/microsoft.devices.radio.fmradio.frequency(v=vs.105).aspx
In other words, there is no Windows Phone Runtime API to control the radio.
I've just tried out an FM Radio app from the store, which does work.