Want to listen a notification when a connected Bluetooth device leave the range - ios7

I want to listen a notification when a connected bluetooth device gets out of range. I want that notification in both cases [either the app is running or the app is in suspended state].

As per Developer Documentation: Core Location Documentation
https://developer.apple.com/library/ios/documentation/CoreLocation/Reference/CLLocationManager_Class/index.html#//apple_ref/occ/instm/CLLocationManager/startMonitoringSignificantLocationChanges.
Apps can expect a notification as soon as the device moves 500 meters or more from its previous notification. It should not expect notifications more frequently than once every five minutes. If the device is able to retrieve data from the network, the location manager is much more likely to deliver notifications in a timely manner.
For detailed info on how to get location services follow this link
http://mobileoop.com/getting-location-updates-for-ios-7-and-8-when-the-app-is-killedterminatedsuspended

Related

Cumulocity - managedObject Event - detect device first connection

Looking to understand whether there is a a bulletproof event from the namagedObject side of c8y where we know the device has just connected.
I have a microservice that listens for events in real time and I want to trigger a process once we know a device has connected to send its payload.
We have used:
"c8y_Connection": {"status":"CONNECTED"}
We have had the microservice log to Slack all events from managedObjects where we saw for three days the "status":"CONNECTED" value in the payload of our demo devices at reporting times.
But after three days, we see no more this "CONNECTED" state (all payloads showing "DISCONNECTED").
What I am trying to achieve from the inventoryObject event is to understand when a device had connected and sent payload to know when data had arrived. I then go get the data and process it externally. This is post registration and as part of the daily data send cycle for my type of device.
What would be the best way to understand when a device has sent payload in a microservice? I want to notify an external application with either “data is arriving for id 35213” or even better, “data has arrived for device 35213, and here’s the $payload”.
Just as a general information ahead:
The c8y_Connection fragment showing connected shows an active MQTT connection or an active long polling connection and it is only evaluated once every minute.
So if the client is just sending data and immediately disconnecting afterwards this might not picked up.
If you want to see the device having send something to Cumulocity maybe the c8y_Availability fragment is a better as it holds the timestamp when the device last send something.
{ "lastMessage": "2022-10-11T14:49:50.201+09:00", "status": "UNAVAILABLE"}
Also here the evaluation (or better the update to database) only happens every minute.
Both c8y_Availability and c8y_Connection however are only generated if the availability monitoring has been activated for the device (by defining a required interval for the device).
So if you have activated the availability monitoring and you see a "lastMessage" you can reliably say that the device has already send something to Cumulocity.

Communication is lost on wifi toggle and onDisconnect and onPeersDisconnected not being fired

I'm using code from Google's sample game "ButtonClicker2000" found here: https://github.com/playgameservices/android-basic-samples
I have 3 androids running this game in genymotion plus one on my own phone, debugging them all from android studio. I've gotten to a point where I'm trying to gracefully handle disconnect in the event of network issues. The way I'm simulating network issues is toggling the wifi on my phone. (on or off, same behavior) After that, real time messages from my phone are no longer being received by the virtual devices, and my phone is no longer receiving real time messages from the other devices. However, my phone never enters onDisconnect() and the other devices never enter onPeersDisconnected. If I exit the app on my phone after communication ceases, onPeerLeft fires on the other devices.
How can I either ensure communication between devices in a game isn't lost in the likely event that a user at some point comes in or out of range of their wifi? If that's not possible, how can I at least ensure the onDisconnect event is firing from the offending device and onPeersDisconnected event is firing on the others?
If we're going with what the documentation states, onDisconnect usually happens when there's a problem with the remote services (crash or resource problem). having the WiFi turned off doesn't look like it fits with those criteria. [onPeersDisconnected](https://developers.google.com/android/reference/com/google/android/gms/games/multiplayer/realtime/RoomStatusUpdateListener#onPeersDisconnected(com.google.android.gms.games.multiplayer.realtime.Room, java.util.List)) is called when the participants are disconnected from the room.
Determine if the onP2PConnected is called when its connected and onP2PDisconnected when disconnected (hopefully this can catch WiFi toggling cases) since I think its more appropriate when you're using real-time multiplayer.
You can also read more about it in the Real-time Multiplayer section of the documentaiton.
Hope this helps!

Send notification when bluetooth connection has been made like an iBeacon

Hi I am looking to see if I can send a notification when my iPhone connects to a bluetooth device with my app running in the background. This is similar to what happens with an iBeacon in iOS 7 I am just wondering if this can be done with any bluetooth device. I am ok with using private API's if necessary. If I understand bluetooth correctly, any bluetooth device has to at least communicate its identifier and wait and receive pairing codes so I am hoping i can be able to determine that if a bluetooth device broadcasts an identifier and my phone connects to it then send a notification like an iBeacon.
I have used an Estimote and it can broadcast the proximity and send notifications accordingly, I just want to be able to send a notification when a bluetooth connection has been made from any bluetooth device.
Thank you
On Apple's documentation you can find that you can act as a Bluetooth Central in the background. You should get callbacks if you are scanning for the correct UUID.
I haven't tested this but check that you have the correct UIBackgroundMode key in the info.plist file.
Also your CBCentralManagerDelegate should call the selector centralManager:didDiscoverPeripheral:advertisementData:RSSI: while your app is in the background.

Push Notification service is not working, When device is switch off

I have implement Apple Push Notification in my application.
It's working fine when my iPhone is on.
Now, when I switch off my iPhone and fire notification from the server, it's successfully sent.
but, When I switch on my iPhone, I am not getting any notification.
So, what is the problem ?
Apple Push Notification service includes a default Quality of Service
(QoS) component that performs a store-and-forward function.
If APNs attempts to deliver a notification but the device is offline,
the notification is stored for a limited period of time, and delivered
to the device when it becomes available.
Only one recent notification for a particular application is stored.
If multiple notifications are sent while the device is offline, each
new notification causes the prior notification to be discarded. This
behavior of keeping only the newest notification is referred to as
coalescing notifications.
If the device remains offline for a long time, any notifications that
were being stored for it are discarded.

Will I be able to push notifications from WP8 to a Windows Store app?

I need to pass messages between a WP8 app and a Windows Store app. It's sort of a "peer-to-peer" situation in that they will both send and respond to messages from each other, but it's also sort of a "client/server" situation in that the Windows Store app will have 1..N WP8 apps that it is conversing with.
After being beaten about the head and shoulders for my first ideas of trying to use either email or SkyDrive rather sneakily, I'm now considering these possible architectures:
1) Direct Push Notifications
(a) The WP8 app sends Push Notifications to the Windows Store app via a URI it is provided after this conversation takes place:
Windows Store app: "Will you send me updates?"
WP8 app: "Yes."
Windows Store app: "Okay, here's where to send them."
(b) Windows 8 responds to the arriving msgs.
2) Push-Pull using the Cloud
(a) WP8 sends data to the cloud (Azure?)
(b) Windows 8 app periodically polls for it
3) SSL (Using components from someone like /NSoftware (IP*Works))
The messages from WP8 are rather frequent (every 15 minutes, on average), but small/short (short enough to be a Tweet, in fact). The Windows 8 app deals with these msgs "behind the scenes." The user is not aware of them until he runs the associated app.
There weren't any question marks :) but here's my take:
Push notifications would certainly work, but given your "behind the scenes" comment, you may want to look specifically into "raw notifications", which do use the push notification mechanism but aren't associated with UI (like a tile, toast or badge). Pushed toast notifications, for instance, are dropped if the client if off-line.
The frequency of the messages makes me leery of the polling approach given impact on battery life (that said, not sure how a push notification with background task would compare). With the polling approach too you'd need to have some way on your "cloud service" to maintain messages (storage) and then feed back the right messages on each poll, etc. You'd also need to handle the scaling and availability aspects that WNS would do 'free.' Not rocket science, but more work. The push notification is kind of 'fire-and-forget'.
With sockets, you might have more control to the extent the sandboxed model exposes functionality you need. It seems like more moving parts though, and I'd likely go that route only if the other two approaches are otherwise unviable.