android / enterprise-samples

Multiple samples showing the best practices in enterprise on Android.
Apache License 2.0
387 stars 241 forks source link

Versioning/conditional compilation problems. #36

Closed DonnKey closed 1 year ago

DonnKey commented 3 years ago

The build versioning checks (all of them) check for a change in the definition of what must be sent via NFC, which depends on the receiving device's version. You can't know that at runtime (unless there's some 2-way information flow). (See code involving Build.VERSION.SDK_INT >= 23 and EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME).

Having an old device around to support NFC provisioning seems a perfectly reasonable thing to do.

It clearly will work correctly if the sending and receiving device are the same Android release. If they are not the same (or at least sufficiently different) it may or may not work. In my very limited testing I saw no problems, but I don't have the hardware to thoroughly test.

I can think of a number of ways to address this issue, but getting the "right" solution would be guesswork on my part.

(I've also submitted a pull request with other changes, but I chose not to try to address this issue there, except that I allowed installation on the (ancient) device I wanted to use as NFC sender - which worked fine in my very limited testing.)