- Orientation Lock for Windows Phone 7
Here is the first orientation lock application for Windows Phone 7! Basically, it locks your device screen orientation (do you remember – this function was built-in on your old Windows Mobile phone :)) by setting the accelerometer to power state D4, then back to D0 to revive it.
This project is created using DllImport:
DllImportCaller.lib.StringIntIntCall(“coredll”, “SetDevicePower”, “ACC1:”, 1, (int)Phone.Network.WiFi.PowerState.D0);
The app is very simple and easy to use, it’s already tested on some devices like HTC HD7, Nokia Lumia 800, Samsung Focus and Omnia 7. Also, we tested it and it works perfect on the HTC HD2 with various Windows Phone 7.5 ROM’s.
Anyway, some HTC devices detects the accelerometer sensor as active, even when it isn’t, to fix this you need to toggling the button back and forth to get it working.