Android Manifest: no default activity?

195 views Asked by At

From an open source project I got this manifest file

<?xml version="1.0" encoding="utf-8"?>

<uses-sdk
    android:minSdkVersion="14"
    android:targetSdkVersion="20" />

<uses-permission android:name="android.permission.AUTHENTICATE_ACCOUNTS" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.WRITE_SYNC_SETTINGS" />

<application
    android:allowBackup="true"
    android:icon="@drawable/icon"
    android:label="@string/app_name"
    android:theme="@style/AppTheme">
    <service
        android:name="org.gege.caldavsyncadapter.syncadapter.SyncService"
        android:exported="true">
        <intent-filter>
            <action android:name="android.content.SyncAdapter" />
        </intent-filter>

        <meta-data
            android:name="android.content.SyncAdapter"
            android:resource="@xml/syncadapter" />
    </service>
    <service
        android:name="org.gege.caldavsyncadapter.authenticator.AuthenticationService"
        android:exported="true">
        <intent-filter>
            <action android:name="android.accounts.AccountAuthenticator" />
        </intent-filter>

        <meta-data
            android:name="android.accounts.AccountAuthenticator"
            android:resource="@xml/authenticator" />
    </service>

    <activity
        android:name="org.gege.caldavsyncadapter.authenticator.AuthenticatorActivity"
        android:label="@string/title_activity_authenticator"
        android:windowSoftInputMode="adjustResize|stateVisible"/>
</application>

I am a bit puzzled about that manifest. It has two services and one activity. The activity is not marked as default activity. When I run the project on my phone it doesn't show any icon to start the app neither does the app start automatically.

Does a manifest like this make sense? What does the Android OS based on such a manifest?

1

There are 1 answers

0
laalto On BEST ANSWER

Does a manifest like this make sense?

Yes, since it declares a sync adapter an an authenticator.

Generally, such manifests would also make sense in a library project. The app project that uses the library then provides the main launcher activity. The build process merges manifest files together so you get one manifest per APK.

What does the Android OS based on such a manifest?

As such, it has the entry points such as an activity and two services declared. Generally you invoke these entry points via an Intent. The services are declared as a sync adapter and an authenticator, so they can be invoked by the framework. The activity is probably invoked by the authenticator service for UI purposes.

Because there's no main launcher activity, no menu icon is visible.