android: Main is now a service

- add Settings: Activity to start / stop MPD Service (Main).

- Main is a service that run in foreground with a notification. See
  Service.startForeground documentation for more details.

- Main.Client is used to control the service: start or stop it and also receive
  callbacks when service encounters an error, is killed, is started or is
  stopped.

- Main.start to start the service without any fallback.
This commit is contained in:
Thomas Guillem
2014-09-16 12:00:59 +02:00
committed by Max Kellermann
parent aff070bcbb
commit 54a5491b86
9 changed files with 593 additions and 40 deletions

View File

@@ -8,14 +8,14 @@
<uses-sdk android:minSdkVersion="21" android:targetSdkVersion="26"/>
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".Main"
android:label="@string/app_name"
android:launchMode="singleInstance">
<activity android:name=".Settings"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service android:name=".Main" />
</application>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>