Windows 10 Phone app Turn on flash (lamp) - windows-10

I have a problem. I m a new windows phone 10 developer and i have a problem.
How can i turn on flashlight on a Lumia 930 ? I can t find any answer on internet.
Thx alot,
Regards

The Windows.Devices.Lights.Lamp namespace is where you need to look, there's an example of Lamp usage in Windows 10 https://github.com/Microsoft/Windows-universal-samples/tree/master/lamp that might be of help.
Here's a small example based on this as an alternative to the link:
using (var lamp = await Lamp.GetDefaultAsync())
{
lamp.BrightnessLevel = 1.0F;
lamp.IsEnabled = true;
}

Related

Transmitting as iBeacon in XAMARIN - AltBeacon library

I have come across a problem with iBeacon transmission in AltBeacon library in XAMARIN.
In Android Studio, this code works perfect (I can detect created iBeacon on iPhone). I am using Android 5:
mBeaconTransmitter = new BeaconTransmitter(this, new BeaconParser().setBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24"));
Beacon beacon = new Beacon.Builder()
.setId1("FDA50693-A4E2-4FB1-AFCF-C6EB07647825")
.setId2("1000")
.setId3("2000")
.setManufacturer(0x004C)
.setTxPower(-59)
.setDataFields(Arrays.asList(new Long[] {0l}))
.build();
mBeaconTransmitter.startAdvertising(beacon);
However, I have not managed to attain the same result in XAMARIN (Visual Studio). I cannot detect created iBeacon on iPhone in this case:
var iBeaconParser = new BeaconParser();
iBeaconParser.SetBeaconLayout("m:2-3=0215,i:4-19,i:20-21,i:22-23,p:24-24");
BeaconTransmitter beaconTransmitter = new BeaconTransmitter(ApplicationContext, iBeaconParser);
var beacon1 = new AltBeacon.Builder().SetId1("FDA50693-A4E2-4FB1-AFCF-C6EB07647825")
.SetId2("1000").SetId3("2000").SetTxPower(-59).SetManufacturer(0x004C).Build();
beaconTransmitter.StartAdvertising(beacon1);
The transmission also works in the second case. Other Android device could detect the created iBeacon. It was unsuccessful to detect the iBeacon on iPhone.
Thank you for any advice.
Hey buddy it's been almost 3 years you have ask this question so I don't know that is it still relevant for you or not but my be this will help others.
I have seen this code this is absolutely right for the beacon broadcasting and I will suggest to check that if you have bind IBeaconconsumer with beacon manage in the initialization function Bind((IBeaconConsumer)Plugin.CurrentActivity.CrossCurrentActivity.Current.Activity); or check that if you have use _tagRegion and this refers to right one.
Hope this will help.

D3D9 CreateDevice() fails on Windows 10 when creating a multihead device

When calling IDirect3D9::CreateDevice with the BehaviorFlags D3DCREATE_ADAPTERGROUP_DEVICE in order to create a fullscreen multihead device (with 2 or more monitors attached) the function returns D3DERR_INVALIDCALL, when running the application on Windows 10 (build 1511, or build 10240).
The same code works fine on Windows 7 (on a multitude of different machines), and also on Windows 8.1 (with the latest updates). Also creating individual D3D9 devices (fullscreen) for each attached monitor to the graphics adapter works fine on Windows 10.
D3D9Ex by the way shows exactly the same behavior. Can anyone point me to a working D3D9 multihead example that works on Windows 10? Thanks!
I observed the exact same behaviour with "CreateDevice".
But when you use "CreateDeviceEx" it works ... well ... almost :-(.
You may now create the device and use it, but under some circumstances (especially if you use the same resolutions as the desktop already had) you wont see anything and "Present" will continuously return "S_PRESENT_MODE_CHANGED". But if you now switch the second monitor to some other resolution via ResetEx end then switch back to desktop resolution - voila it works. I put that on on a key I can press after initialization:
const int idx = 1;
int OldWidth = D3DPresPar[idx].BackBufferWidth;
int OldHeight = D3DPresPar[idx].BackBufferHeight;
D3DPresPar[idx].BackBufferWidth = 1280;
D3DPresPar[idx].BackBufferHeight = 720;
D3DDispMode[idx].Width = 1280;
D3DDispMode[idx].Height = 720;
FailCheck(pD3DDevice->ResetEx(D3DPresPar, D3DDispMode), "ResetEX");
D3DPresPar[idx].BackBufferWidth = OldWidth;
D3DPresPar[idx].BackBufferHeight = OldHeight;
D3DDispMode[idx].Width = OldWidth;
D3DDispMode[idx].Height = OldHeight;
FailCheck(pD3DDevice->ResetEx(D3DPresPar, D3DDispMode), "ResetEX");
And after pressing the key it suddenly works. Weird, eh?
I confirmed this behaviour on multiple computers with nvidia, amd and intel grafics adapters. So the bug seems to be on microsoft side.
Conclusion: Theoretically it should work but there is some annyoing bug in windows 10 multihead initialization.
With some weird tricks you can achieve what you want, but these tricks are just too weird to use in production.

Windows 10 sharing app settings between devices with same account

Is there any possibility to do this ?
I'd like to identify the user and one easy way is to save GUID that is automatically visible on other devices with same MS Account.
You can use roaming settings for this
var roamingSettings = Windows.Storage.ApplicationData.Current.RoamingSettings;
// Create a simple setting
roamingSettings.Values["exampleSetting"] = "Hello World";
// Read data from a simple setting
Object value = roamingSettings.Values["exampleSetting"];
if (value == null)
{
// No data
}
else
{
// Access data in value
}
// Delete a simple setting
roamingSettings.Values.Remove("exampleSetting");
https://msdn.microsoft.com/en-us/library/windows/apps/windows.storage.applicationdata.roamingsettings.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2
Oh my...
I spent half a day reading forums and suddenly found an answer, right after posting SO Queston :( Sorry.
Microsoft has good buch of Win10 samples, and one of them describes ApplicationData.Roaming -
https://github.com/Microsoft/Windows-universal-samples/tree/master/Samples/ApplicationData
Any file that is put to this folder is synced to other devices automatically.

Windows.UI.Popups.MessageDialog does not work for Windows 10 IoT

await new Windows.UI.Popups.MessageDialog("Test").ShowAsync();
Has anyone else noticed this? Is there an easy work around ?
I have the some problem and I did't found any trick. I made myself a MessageDialog with a and It's not so hard to build it. Try do take a look this http://bitaware.altervista.org/messagedialog-for-iot/
The unique problem is that it do not work across platforms. If you would this behavior you have to get a condition
string platform = AnalyticsInfo.VersionInfo.DeviceFamily;
if (platform == "Windows.IoT")
{
//Your code for IoT
}
else
{
//Your code for other devices
}
I know is not elegant but I think we have no other choice.
I hope it was helpful

Xamarin.iOS geolocation

I have been browsing the web for a couple of hours to find ways to get the device's geolocation but to no avail.
I could find some documentation for android, but nothing for iOS. Anyone has any ideas or can point me to the right direction?
The Xamarin.Mobile component has a cross-platform GeoLocation service. It comes with samples.
Xamarin also has a Core Location sample app.
This question has also been asked and answered on Stack Overflow many times.
CLLocationManger lm = new CLLocationManger();
... (Acurray)
... (Other Specs)
lm.LocationsUpdated += delegate(object sender, CLLocationsUpdatedEventArgs e) {
foreach(CLLocation l in e.Locations) {
Console.WriteLine(l.Coordinate.Latitude.ToString() + ", " +l.Coordinate.Longitude.ToString());
}
};
lm.StartUpdatingLocation();

Resources