Windows Phone 8 App communicating with a Bluetooth device - windows-phone-8

I have a task to communicate with a Bluetooth device (which is not Low Energy - BLE) from a Windows Phone 8 App and latter from Surface App.
I came across this link http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj207007(v=vs.105).aspx which does mention about Bluetooth integration, however it doesn't clearly says if this is for only BLE devices or not?
Please can someone point me to a code sample which I can use to interface (send and receive) data from Bluetooth device. Esp, a RFCOMM e.g., if possible
Really appreciate.

The following example shows how to create a Bluetooth RFCOMM socket connection to connect your app to a device:
Windows Phone 8 Networking Samples
Basically, you have to create a socket connection with a paired Bluetooth device:
PeerFinder.AlternateIdentities["Bluetooth:PAIRED"] = "";
var available_devices = await PeerFinder.FindAllPeersAsync();
if (available_devices.Count > 0)
{
PeerInformation pi= // Select the device
}
StreamSocket socket = new StreamSocket();
await socket.ConnectAsync(pi.HostName, "1");
This example was shown in Build 2012 conference. You will find the video of the presentation here:
Windows Phone 8: Networking, Bluetooth, and NFC Proximity for Developers (Build 2012)

Related

In Windows Phone 8.1, Is it possible to read mac address of device

In Windows Phone 8.1, Is it possible to read mac address of device.
I want to build a app which search the all available network and connect to the preconfigured(in app) network.
and also turn on the WiFi using C#
The Windows Phone OS does not give access to programmatically join networks, this has to be an action initiated by the end user, it is possible however to enumerate the current network connections whic does allow some information about the adaptor, but apparently not the physical (MAC) address...

Windows Phone 8 and LAN communication Client-Server-Client

I want to make Client(WP8 device) -> Server(Windows 8 Desktop device) -> Client(WP8 device) connection. By this conn I wanna send data from one phone to another phone. What should I use? TcpClient in Net.Sockets is not supported by WP 8 as well as UdpClient.
Did you have a look at this Communications for windows phone
And maybe this might help as well How to create and use a TCP socket client app for Windows Phone

Keep connection between Windows service and Windows Phone app alive

So, I would like to have a Windows Phone app "connected" at ALL TIME with a Windows service.
That means that the service would need to know if a device has been turned off or lost network connection within seconds after it happens. On iOS and Android we keep this connection up with sockets. But this doesn't seems to be possible with background tasks on Windows Phone?
Is there somehow we could "ping" the server/service more often then every 30 mins from a scheduled task? The app will only be used by known people so if there is a possibility to "fake" a music app och location app that would do it. The app will probably be released as a enterprise company app so all users will be aware of the possible "battery drain" that could be caused.
If using Push notification, how long can it take before a device gets it and could the service know right away if that device received it?
You can use geolocation service and keep your app in background or even fake audio agent. You are free with choice because company apps have no public certification process.
Here is some info about Company Hub and enterprise deployment of Windows Phone 8 apps.

Using PeerFinder inside local wired network for P2P communication between Windows 8.1 store apps

Is it possible to use PeerFinder for initiating connection between applications in different PCs inside intranet?
I tried ProximityCS (Windows 8.1) sample and PeerFinder.SupportedDiscoveryTypes returns None for me. (Tested with Windows 8.1 Preview)
I have only found samples to connect using NFC or WifiDirect.
Is there any samples of using Infrastructure (TCP/IP) way of connecting?
Is it possible do this manually using Broadcast messages from Windows Store app?
Windows store apps support multicast; from this you can build your discoverability solution. There's a short video how-to about this on the Channel 9 site at http://channel9.msdn.com/posts/Multicast-LAN-Discovery
To send a multicast message in Windows Runtime, just send it to a multicast address. To receive, you just call JoinMulticastGroup and you can start to receive. To increase your code robustness, re-join when you learn about new networks; this will join the multicast group on newly available adapters.
Peerfinder is part of the Windows.Networking.Proxmity namespace which, as you have mentioned, supports only NFC and WifiDirect for communication and data transfer between two applications in different PCs.
Have you tried using StreamSocket so as to emulate a client-server like communication between two applications?

Cannot persist IsolatedStorageSettings data (C#)

I'm developing a windows phone 8 application, which relies on IsolatedStorageSettings for saving application settings. I don't own a real device, so i'm using the emulator to test the app. Application settings persist correctly during the whole application lifecycle, even when you quit the application by navigating to the Windows Phone 8 start page and re-run it.
Application settings don't persist if i close the emulator and re-run the app.
The question is: would application settings persist correctly in a real device after it has been turned off?
Thanks
Yes. IsolatedStorage is persistent across power on/ off cycles of the device. The Application settings or IsolatedStorage is cleared only when the user removes(uninstalls) the app from the device.