Emulate Motion API on an emulator - windows-phone-7

I am developing an app which uses a accelerometer + compass sensor and I would like to run it the emulator. The problem with that is that Mango only allow to emulate Acceleromter, but it doesn't to emulate Motion.
I thought of creating a Mock object using the same base class as Motion does (SensorBase - abstract class), however it's constructor is internal and I can't inherit from it :/
Any ideas how to overcome it?

I have solved it by wrapping a Motion service inside an object which exposes the functionality of the motion service using ReactiveExtensions.
So in the end I would simple have to emulate a sequence of numbers.

Related

bluetooth LE MVC architecture

I am developing an Android app that connects to a device and send command to get its information such as version number.
I am building it using the Bluetooth LE sample code which has DeviceScanActivity, DeviceControlActivity and BluetoothLeService.
I am trying to understand the structure so I can make the code separate from GUI and low level operations.
Is DeviceControlActivity equivalent to View + Control in MVC model? Is BluetoothLeService equivalent to Model?
I want to have a class separate from GUI that has functions to operate the device. eg. contains a function called getVersion(). Does this class belong to Model as well? How should I implement this class along with BluetoothLeService?
Basically I want to have a hierarchy as UI->a Class of functions->Bluetooth rx & tx.
I created an instance of the class of functions and I derived command data from it.
Then I sent this command to BluetoothLeService.

How to add google map and map pins using Xamarin cross platform

I'm new to the Xamarin. I need to create a small application to make use phone resources and google map.
For resources access like, call, sms, flash on/off you can make use these
phoneDialer.MakePhoneCall(phoneNo);
smsMessenger.SendSms(phoneNo, smsMessage);
CrossLamp.Current.TurnOn();
CrossLamp.Current.TurnOff();
I think this will help you get some idea. You can also create a utility class where you can create a function and make use these for all platform and you can call the corresponding functions whenever it is necessary.

Can the Pebble timeline be used via Pebble.js?

It's unclear whether the Timeline features are supported when using only the pebble.js approach (e.g. no C code). Can anyone comment?
Yes, you can use Pebble.js to call regular PebbleKitJS functions (e.g., Pebble.getTimelineToken).
As far as pushing pins to the timeline, pins are pushed via the timeline Web API, which means you can use the ajax function to make a request to the API from within Pebble.js.

Xamarin XLabs IOC and camera

I'm looking at https://github.com/XLabs/Xamarin-Forms-Labs/blob/master/Samples/XLabs.Sample/ViewModel/CameraViewModel.cs to try and get the camera available to my app.
I have this setup the same, but when I run my app the iOS app that calls my PCL is giving the error:
IResolver has not been set. Please set it by calling Resolver.SetResolver(resolver) method.
I don't know what this means or what exact code I need. I don't use IOC at all and I don't much care about it but I just want this camera to be available to my PCL. How can I get this camera available to my PCL when I'm not using MVC here.
If you wish to use the ViewModel then modify the constructor to take in IMediaPicker:
https://github.com/XLabs/Xamarin-Forms-Labs/blob/master/Samples/XLabs.Sample/ViewModel/CameraViewModel.cs#L62
public CameraViewModel(IMediaPicker mediaPicker)
{
this._mediaPicker = mediaPicker;
}
Remove the Setup function:
https://github.com/XLabs/Xamarin-Forms-Labs/blob/master/Samples/XLabs.Sample/ViewModel/CameraViewModel.cs#L156-L167
How you get the IMediaPicker implementation to PCL is up to you. IoC is the preferred (and easy) way but you can use other patterns as well. One would be to define a static Func<IMediaPicker> property on the ViewModel and set it in the platform specific projects.
IoC container is the easiest and quickest way to get it done and it would as simple as adding these lines at the application startup (e.g. AppDelegate's FinishedLaunching method):
var container = new SimpleContainer();
container.Register<IMediaPicker, MediaPicker>();
Resolver.SetResolver(container.GetResolver());

switch the cameratype in Windows Phone7

all, as we know, the CameraType property indicates the location of the camera on the device. But when I try to swich the cameratype from Primary to FrontFacing by using the following code, it does not work. After reviewing the MSDN document, I found it was a protected set method. And obviously I have no access permition. Is there any way to do that?
Could any one help me?
Thanks in advance!
camera.CameraType = CameraType.FrontFacing;
It seems like you can't force the camera to a different mode after you initialize it.
Use the constructor of the implementation.
For ex: Constructor of PhotoCamera class
I assume you're trying to create a custom camera app ? or something similar ?
If you just want to capture a picture, use Camera Capture Task instead of this. Otherwise your app will fail certification.
If photo capture is not a core feature of your application, consider using the Camera Capture Task to capture photos instead of using the camera APIs directly. Memory allocated for the Camera Capture Task does not count toward total application memory use. This helps minimize your application’s memory use, which is particularly important when your application runs on a 256-MB device. For more information, see Developing for 256-MB Devices and How to: Use the Camera Capture Task for Windows Phone.

Resources