Set FM Radio frequency in windows phone 7

try { FMRadio myRadio = FMRadio.Instance; myRadio.PowerMode = RadioPowerMode.On; myRadio.CurrentRegion = RadioRegion.Europe; myRadio.Frequency = 91.5;   if (FMRadio.Instance.SignalStrength == 0.0) { MessageBox.Show("FM radio cannot run on emulator"); } } catch (Exception ex) { MessageBox.Show("FM Radio has thrown exception" + ex.Message); }   The RadioRegion enumeration only support 3 frequency bands for FM Radio tuning. 1. […]
Continue reading…

Enjoyed this post? Share it!

 
 

AccelerometerFailedException in windows phone 7

Accelerometer aSensor = new Accelerometer();   // Add the accelerometer event handler to the accelerometer sensor aSensor.ReadingChanged += new EventHandler<AccelerometerReadingEventArgs>(AccelerometerReadingChanged);   bool isActive = false; // Start the accelerometer try { aSensor.Start(); isActive = true; } catch (AccelerometerFailedException e) { // the accelerometer couldn’t be started. isActive = false; } catch (UnauthorizedAccessException e) { // […]
Continue reading…

Enjoyed this post? Share it!

 
 

Reading accelerometer data in windows phone 7

Add a reference to the Microsoft.Devices.Sensors assembly, and declare an instance of the Accelerometer class. Call the Start() method to generate accelerometer readings. using Microsoft.Devices.Sensors;   Accelerometer accelerometer = new Accelerometer(); accelerometer.Start(); accelerometer.ReadingChanged += new EventHandler<AccelerometerReadingEventArgs>(accelerometer_ReadingChanged); The event handler void accelerometer_ReadingChanged(object sender, AccelerometerReadingEventArgs e) { float X = (float)e.X; float Y = (float)e.Y; float Z […]
Continue reading…

Enjoyed this post? Share it!