This has been asked before with no responses, so I will try to phrase the question a bit differently. What are the various ways to pass some data to an Android Service
without being able to bind to it or start it myself?
Here's the issue - I have a HostApduService
that is started by the operating system on every NFC card transaction. It requires the permission android.permission.BIND_NFC_SERVICE
, which is a system permission, so my application can't bind to it. I don't want to leave data at rest so anything that gets written to the disk is a no-go. I thought of a few possible solutions, but they are either messy or insecure:
- Put the data in our app's SharedPreferences. This presents a DAR issue.
- Broadcast information to the
Service
. TheHostApduService
runs for the duration of the card transaction, so I can't reliably time the broadcast to reach the service before it starts working. - Put the information I want to pass in into a
static
field somewhere. This is messy and could potentially cause concurrency issues, but is what I'm currently using.
Any other ideas? Thanks in advance.