Id like to enable bluetooth like in this example.
However my class isnt a Activity but a Service and therefore I can't call startActivityForResult. How can i solve this problem?. I know there are other questions that have been answered like
use startActivityForResult from non-activity
but this doesn't solve my problem because my application consists of the service and nothing else.
I know this is an older question, but I've run into a similar challenge, and my solution was to create an activity with android:theme="@android:style/Theme.NoDisplay", and then call startActivityForResult() from that. That creates an invisible activity that can both request and receive the intents, before writing data somewhere and then finishing itself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With