What is the preferred state of the app in order to receive a proximity-based offer - App in foreground, background or not-yet-launched?
There are mixed opinions on this, some say how should a user know he should have the app launched, on the other hand if the app is not launched, a deamon process needs to be listening to BLE packets (and consuming battery).
I'm trying to understand what some of the real applications are doing in practice.
Beacon apps that present offers when a user is nearby typically require background detection of beacons, because it is unlikely the user will know to manually open the app at the right time.
This is possible on both iOS and Android, provided that the beacon app is already installed on the phone. Both platforms allow ways to do low power beacon scanning in the background that will deliver a callback to an app when a beacon matching an identifier pattern is detected.
The basic practice is to have the app register for these callbacks the first time it runs, so even if the phone is rebooted, it will be notified of a detection.
As you say, background scanning requires some battery usage, but there are optimizations that make this acceptable on both Android and iOS. These optimizations are automatic on iOS and the implementation closed source and undocumented. On Android, similar optimizations are provided by the open source Android Beacon Library. You can read about how background launching works here and battery saving here.
Full disclosure: I am lead developer on the Android Beacon Library project.
Related
I am trying to connect to my iPhone and access services such as the battery level and ANCS from windows. I have tried out the Advertisement watcher and query but I feel as though they are really inconsistent. I am just using the code they provided in their updated documentation. I feel as though my results are extremely buggy. Devices show up multiple times and then become unreachable. It's almost as if past devices are never cleared from the cache (this may need to be something I do manually?) upon restarting my UWP in debug x86. I have briefly had success with the advertisement watcher and was even able to initiate pairing. Although when I read the battery level it was still not a number after using the data reader. I noticed that there were some service solicitation properties on the documentation but I could not figure out how to use them. Would these help and if so how could I use them? This might be useful when I try to connect to the ANCS of my iPhone.
Edit 1: After trying out the sample provided by Microsoft, I am still having a similar issue. I am able to see devices and even pair with them but when I click the connect button, it returns that there is a connection failure. In order to advertise to the BLE I am using the LightBlue app on my iPhone to advertise a virtual peripheral with the battery service added. My end goal is to connect to the iPhone directly and access some of its native BLE services and characteristics. I have heard that this can be done with something called service solicitation but have failed to successfully find any real examples of this being put into practice in a UWP (maybe it's not used anymore). I am still pretty new to BLE so I am trying to work out some of my fundamental misunderstandings of how it works so if there is something I am missing please let me know below!
BLE Failing to connect after pairing.
Edit 2: Ok after cleaning and re-building to fix some of my silly mistakes, I can now say that the example project is running as intended from what I can tell. The solution is actually pretty nice and I can see it is much more elegant than my implementation. However, I see that I am running into the same issue as before where the services of my virtual peripheral become undiscoverable after pairing and now result in a "Device Unreachable" exception in scenario 2. It seems as though Windows does not support "Resolvable Random Private Addresses." To elaborate, it does not provide my phone with an Identity Resolving Key (IRK) upon pairing with my iPhone 11 in order to keep track of its address. In order to access certain key characteristics, I need authorization.
Is there any way I can exchange an IRK upon pairing using the custom pairing capability or is there another method to provide authorization in order to access these characteristics on my iPhone? As it is, ANY and ALL GATT services present on the iPhone (virtual peripheral or native OS) become unreachable as soon as I successfully pair with the device. I am hoping it is possible to implement a solution in Windows as if not then communicating meaningful data between modern devices seems impossible with outdated privacy protocols.
I did a little bit of research and it is either the problem above or something to do with my Bluetooth device.
If I were to try to access characteristic without pairing
Edit 3: I have been able to get it to work briefly and it was wonderful. I used the system settings to pair and magically got the prompt on my phone to share notifications. From there, I had authorization/authentication and everything else I wanted to do was a breeze. Unfortunately, this does not seem to be reproducible as I have to randomly pair and unpair while starting and stopping the sample solution to get this prompt. I don't entirely remember what was happening when it popped up, but it does not seem easy to recreate. I thought that pairing would be my solution, but I am now stuck. When I pair with the device, I cannot access any services, but when I am unpaired, I can see all of the services and characteristics I need. However, when trying to subscribe to those characteristics I get "System.Exception: 'The attribute requires authentication before it can be read or written. (Exception from HRESULT: 0x80650005)'." Is there any way for me to request access to the notifications on my iPhone using something in the documentation? I need a reproducible way to request system notification access on my iPhone.
I have been searching to know what exactly Kiosk Mode means. Can someone please confirm to me that running an application in full screen whilst disabling power, volume and home buttons indeed amounts to running it in Kiosk Mode?
Also, is there any samples available to implement it in Xamarin.Forms?
Thanks for your time.
"Kiosk mode" usually means some kind of mode where operations outside those provided by an app are disallowed. Typically it's a feature of the operating system, not your app (although depending on the platform, you may need to make certain assertions in your app).
On iOS, this mode is called Guided Access. Your app can request Guided Access provided the target device is being appropriately managed/supervised with Mobile Device Management. There's another, more locked-down mode called Single App Mode which is also managed with Apple Configurator.
On Android, this mode is called Lock Task Mode. Here's the Xamarin documentation about it. The Android docs have a good overview of how to manage all this.
If you ever decide to produce a UWP version of your app too, Microsoft's equivalent is called Assigned Access.
We are planning to integrate a BLE compatible Bluetooth module on one of our product hardware. For the last few days I have been digging around the net and got a fair idea about the technology. Now that I have an understanding of the tech, I think we have a choice of going with either of iBeacon, AltBeacon or Eddystone as the advertising format.
Please note that we would not be approaching a BLE vendor but instead we would be approaching a chip manufacturer like Texas instruments or somebody who would be delivering our original hardware. The Bluetooth module is a last minute addendum.I guess chip manufacturers would be open to work with any of the advertising formats as we suggest them (this is my guess. I have no clue on this). But let's say if they are, which would be the preferred format to go with ??
My 2 cents -
I understand iBeacon compatible devices would have some kind of a
cert process from apple. We want to avoid any kind of mandatory cert
process. As I mentioned the Bluetooth module is only an addendum for
us.
iBeacon seems to be the most mature since it has been around for a while
AltBeacon looks to be almost similar to iBeacon with a bit of more flexibility and sans the Apple luggage. Is there any cert required by
the owners i.e. Radius Networks ??
Eddystone looks to be the most robust and future proof. Again is there a cert process ?
What are our concerns -
Low cost.
Low battery consumption.
Changing payload after deployment.
Host processor should be able to turn ON/OFF the on-board BLE device. The latency should be low in such case.
We should be able to monitor Beacon health i.e. if any beacon is down.
Security.
Are there any other things we should be concerned with ?? :)
Yes, you will need to use iBeacon if you need scanning in background on iOS. Android can scan in background for any advertising payload.
The StackOverflow rules do not allow recommendations, but I will answer two embedded questions:
AltBeacon does not require any certification, but you obviously must meet the spec for it to work with other devices.
Eddystone similarly does not require pre-certification, but you may optionally do so to have your products listed on Google's website listing of compatible manufacturers.
#Simon-Judge is mostly correct in his answer that iBeacon provides fastest background on iOS. However, you can detect Eddsystone formats in the background on iOS as they use service advertisements which iOS APIs allow. This is much slower than iBeacon (typically 10 minutes vs. 5 seconds for iBeacon). AltBeacon, by comparison cannot be detected at all in the background on iOS as it is a manufacturer advertisement. The only manufacturer advertisements that can be detected in the background on iOS are iBeacon advertisements.
I've noticed while I'm out and about (specifically at HyVee and Walmart) that the Continuity prompt (bottom-left corner of the lock screen) shows the App Store. When I open it, it takes me to their respective apps to be downloaded.
I thought that Continuity only shared to other devices with your Apple ID, so how are they advertising their apps? Are they receiving App Store links from nearby iBeacons? Various Google Search terms haven't turned up any information.
This is the new Suggested Apps feature of iOS 8. This is an AppStore feature that uses geofences (not beacons) to find apps relevant to your location. The description of this feature in settings says:
Leaving this option turned on will allow iOS to offer suggestions for App Store apps that you do not already have installed. These can be based on what you already have installed or what people near you find interesting.
Apple's mechanism for suggesting apps is undocumented. Perhaps it is based on an algorithm (other folks regularly using an app in the vicinity), a database (known locations of major retailers), or paid marketing (e.g. Starbucks pays Apple to suggest their app when near one of their shops.) It could be a combination of all three.
I know that this technology is not based on beacons (at least not exclusively) because I received an app suggestion for Starbucks (without having the app installed) and then I immediately used a non-iOS-based beacon scanner that verified no beacons were in the vicinity.
In "old" times I created simple tool for Windows users, which tracks what they were doing in the front of computer (where simple activity monitor). I was using Win32 api and functions like GetForegroundWindow, GetWindowThreadProcessId, etc.
Yesterday I installed new Windows 8 and tired to run my program. I got 50% success: for "classic" desktop it works like always:).
For Metro UI I just got one application: WWAHost :( without any details.
So my question is: is there a any way for tracking active application in Metro UI?
Thanks for help
UPDATE:
I'm trying to access Metro UI app from Win32, I know that accessing Metro app from another Metro app is impossible
You see, in WinRT, your application is the top-most application. And when your app is not the top-most application then your threads are suspended and the kernel will not schedule any more operations for your app. End of story.
This means what you are wanting to accomplish cannot be done in WinRT. You are thinking more like a resident app or a service with access to the desktop. Those apps have two advantages. 1) they are always running. And, 2) they have the API to do what you are wanting.
WinRT intentionally puts apps in a sandbox so that the user's experience, performance and battery life are protected. Your scenario and scores more like yours underscore the continuing need for desktop apps. (as long as there is a continuing need for those types of apps ;)).
Sorry, if this is bad news.
As for enumerating other apps. This is also not possible. You cannot know if another app is installed or if it is running. You can call out to another app through protocol activation or file activation or (in a sense) through the share contract. But you are unaware if they get the message and if the user has it installed in the first place. And this is by design.
It is worth mentioning that you can pinvoke to Win32 APIs in your WinRT application. It causes lots of problems and can create a headache to get certified into the store. But even then, not all APIs are open to you. And you will find this particular use case is a non-starter.
I am sure this will not be possible. With Windows 8 'Metro' only a single application is active. All other applications will be in a suspended state whilst the topmost application is running. This makes it impossible to write an application that monitors other applications which are currently executing.
See the numerous articles on the Windows 8 app lifecycle.