0

I wanted to make an app for Android and Android TV that acts as a screen saver. After studying this material:

Creating a screensaver in Android

I realized that I need to add a special permission:

  • android.service.dreams.DreamService

  • android.intent.action.MAIN

  • android.intent.category.HOME

  • android.intent.category.DEFAULT

But unfortunately this doesn't work. The app doesn't show up in the screenserver lists either on Android TV or on my phone.

List of all screensavers

Can you help me?

Android Manifest:

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

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


    <application
        android:allowBackup="true"
        android:dataExtractionRules="@xml/data_extraction_rules"
        android:fullBackupContent="@xml/backup_rules"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:permission="android.permission.BIND_DREAM_SERVICE"
        android:theme="@style/Theme.Screensaver"
        tools:targetApi="31">

        <activity
            android:name=".MainActivity"
            android:exported="true">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.HOME" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.LAUNCHER" />
                <action android:name="android.service.dreams.DreamService" />
                <category android:name="android.intent.category.DEFAULT" />


            </intent-filter>

            <meta-data
                android:name="android.app.lib_name"
                android:value="" />

        </activity>
    </application>

</manifest>

Java:

package com.tv.screensaver.test;

import androidx.appcompat.app.AppCompatActivity;

import android.app.Activity;
import android.os.Bundle;
import android.view.WindowManager;

public class MainActivity extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        getWindow().addFlags(
                WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
                        WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON |
                        WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
    }
}

P.S I'm new to StackOverflow and not really programming in Android Studio (I'm 13 years old)

I realized that I need to add a special permission:

  • android.service.dreams.DreamService

  • android.intent.action.MAIN

  • android.intent.category.HOME

  • android.intent.category.DEFAULT

But unfortunately this doesn't work. The app doesn't show up in the screenserver lists either on Android TV or on my phone.

List of all screensavers

0 Answers0