Paul
Paul

Reputation: 4430

Installation only as a widget not as an app

I have to make sure that the installation is only as a widget not as an app, so it should not appear among apps.

This is the manifest file, considering that I have to keep the activity .WidgetConfigureActivity, which is used to configure the widget.

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.widgettwitter">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">

        <activity android:name=".WidgetConfigureActivity">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

        <receiver android:name=".WidgetProvider">
            <intent-filter>
                <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
                <action android:name="com.widgettwitter.WIDGET_REFRESH" />
            </intent-filter>

            <meta-data
                android:name="android.appwidget.provider"
                android:resource="@xml/widget_info" />
        </receiver>

        <service
            android:name=".WidgetService"
            android:permission="android.permission.BIND_REMOTEVIEWS" />
        <service android:name="com.widgettwitter.TwitterService" />

    </application>

</manifest>

Upvotes: 0

Views: 266

Answers (1)

guipivoto
guipivoto

Reputation: 18677

To hide the app from app-tray, you can just remove the line below:

<category android:name="android.intent.category.LAUNCHER"

Since you app does not have a "default" activity to be started, you can configure the Android Studio to either do nothing or start an specific activity.

To just install the app:

Run -> Edit Configurations -> Launch Options and select "Nothing".

To start a specific activity if you want:

Run -> Edit Configurations -> Launch Options -> Specified Activity and select the activity that you want.

Doing that, you will be able to launch/install your app using Android Studio

Upvotes: 2

Related Questions