Android APP转成launcher

一、背景

使用场景,需要开机的时候,自动启动app,解决方案为将Android app转成 launcher app,可实现效果。

二、实现

在app入口activity 的配置文件(AndroidManifest.xml)对应位置,添加

复制代码
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.HOME" />

案例代码:

复制代码
  <activity
            android:name=".ui.activity.splash.SplashActivity"
            android:exported="true"
            android:largeHeap="true"
            android:persistent="true"
            android:theme="@style/Left_Right_AnimTheme">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.HOME" />
            </intent-filter>

        </activity>
相关推荐
好的佩奇2 小时前
Dart 之集合元素
android·flutter·dart
Easyhood3 小时前
Android 开发入门实践(十四):Compose 副作用入门与四个常用 API
android·开发语言·kotlin·android jetpack·compose
FlightYe5 小时前
音视频修炼之容器与协议(四):RTSP详解
android·linux·ffmpeg·音视频·dash
疯华整猫6 小时前
删掉 LeakCanary 那天,我用 Trae 自己撸了一套:最难的不是分析堆,是决定什么时候 dump
android·人工智能·性能优化
mmsx14 小时前
耳切法切带洞多边形:论文能跑通,真实数据为什么崩
android·kotlin
洞见前行14 小时前
你的 Activity 关了,为什么还活着?Android 内存泄漏从发现、定位到线上治理
android·性能优化·leakcanary
Kapaseker16 小时前
Kotlin 又要加语法糖了:这次轮到 if-else
android·kotlin
恋猫de小郭17 小时前
Flutter 3.50 & Dart 3.14 发布,快来看看有什么更新吧
android·前端·flutter