A
A
artemutin2015-11-01 14:40:05
Android
artemutin, 2015-11-01 14:40:05

How to create a demon?

Hello.
I want to make my own logger that records information about the songs played on the device (like a scrobbler). In fact, all that is required is to write the player's state changes to a file for further export. Found that for this, you need to create your own broadcastReceiver . In this regard, the question is, what is the easiest way to create such a demon-like logger in Android? I know Java a little, but with Android everything is by tag.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
lopatoid, 2015-11-05
@lopatoid

Here is an example:
https://developer.android.com/reference/android/su...
There is both a broadcastReceiver and a service (what you called a daemon) there.
Just copy-paste the example, but in the BroadcastReceiver you react to the desired Intent (you already found it on SO), and in the service you write to a file.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question