Is it possible in a Windows Phone 8 app that isn't active to detect Bluetooth connections and react to them?
I want to build a app the does some stuff as soon a the phone connects to the Bluetooth device. I.e. get in range of the device.
I'm realizing that this might be more than one question.
a. is it possible to detect bluetooth connection when the app isn't active.
b. is it possible to "popup" the app if it detects a connection?
All connections of any kind are suspended when the application is in background mode. Your application cannot really respond to any events at all.
Unfortunately, this is the limitation of the sandboxed app model which lives in isolation from the operating system. When in background, it is suspended and no sensors nor connections live.
Related
In a normal Windows Forms Application for laptops (not a Windows store application) I need to communicate with a Bluetooth device.
For communicating with Bluetooth I need Windows' Bluetooth libraries:
see this link
Can anyone tell me how to add this reference into a normal application ?
My impression is that Microsoft has totally forgotten that normal applications need to communicate with Bluetooth as well sometimes .
Or am I overlooking something ?
My Windows Phone 8 application checks network connectivity in OnNavigatedTo method. If the application finds out there's no network available, what should my program do?
If it was a desktop application, I would pop up a message box, saying "network is required", and exit the program.
I hear in WP exiting is not recommended; we don't often call Application.Current.Terminate().
Is there a way to suspend the application, return to the "desktop" and when users turned on Wifi, he can run my program and raises OnNavigatedTo again?
I know turning on Wifi automatically by the program or navigating to Setting page would be a good design. But I'm currently curious about suspending/minimizing the application.
No. There is no good way to programmatically suspend the app. You could hack it by launching another app, but that wouldn't be a very good user experience.
In your case I'd display a message that the app cannot continue without network access and wait for the network. The app isn't completely dead since the network may connect either on its own or by user action.
Flaky network connections are annoying enough without being compounded by the app exiting and users needing to restart it if they temporarily move in and out of a dead spot.
See How to detect network changes for Windows Phone 8
I want my windows phone app to communicate with a desktop app (in Windows), basically i want to send a picture which is captured in the phone to be send to the desktop app and get back the feedback from the desktop app.
Whats the most elegant and modular and simple way of doing this?
If you can force your user to connect via wifi such that he is on the same local network as the desktop, you listen for the phone's connection on a higher port and transfer the data to/from it over TCP directly.
Otherwise, the best way to do this at present would be via the internet, using your server to synchronize files and messages between the two devices.
On other windows operating systems, I could create a Windows Service that listens to TCP/IP for any communication (like a PBX for example) through sockets.
But, how would i handle this in Windows 8? Applications can't run there all the time and when Windows 8 Metro starts up, applications for the normal desktop aren't running.
I need this service to start up all the time in any situation as soon as the computer starts up...
I also need http://pcapdotnet.codeplex.com an open source project to analyze the network...
What's the best future proof practice in an enterprise environment?
I don't have any Windows 8 experience on me yet.
Try this: If you make your windows service depend on something like the computer browser or could be the workstation service. The net connection should be up then.
You have to code this dependency in (no sample on hand).
I want to create an easy application for windows mobile devices, i have recently got a HTC HD2 and the connection is being eaten by the weather app, email accounts and windows live service :#
I am getting rather annoyed with this and well I have set myself a project to give myself a small piece of glory and create a working application that will Terminate an idle connection on my phone.
I am using C# and the latest WM6.5 sdk.
How do I access these controls?
You should use the ConnectionManager APIs to access device connections. It will create them or hand existing connections to your application. Closing a connection is actually very difficult to do (probably becasue it's not terribly nice to tear a connection out from under another running app) and has to be done via P/Invoking to RAS.