uniapp android 开机自启动解决方案

Android 开机自启动方案一(推荐)

在HBuilderX中,在根目录右键菜单 "新建" -> "自定义文件"

输入文件名称 AndroidManifest.xml(注意大小写敏感),点击 “创建” 按钮新建文件 

然后,填入Android原生的自启动配置(注意替换为你的名包)

<?xml version="1.0" encoding="utf-8" standalone="no" ?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:compileSdkVersion="33" android:compileSdkVersionCodename="13" package="你的包名" platformBuildVersionCode="33" platformBuildVersionName="13">
	<application android:allowBackup="false" android:allowClearUserData="true" android:appComponentFactory="androidx.core.app.CoreComponentFactory" android:debuggable="false" android:extractNativeLibs="true" android:hardwareAccelerated="true" android:icon="@drawable/icon" android:label="@string/app_name" android:largeHeap="true" android:name="io.dcloud.application.DCloudApplication" android:supportsRtl="true" android:usesCleartextTraffic="true">
        <activity android:configChanges="fontScale|keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize" android:exported="true" android:hardwareAccelerated="true" android:label="@string/app_name" android:name="io.dcloud.PandoraEntry" android:screenOrientation="user" android:theme="@style/DCloudTranslucentTheme" android:windowSoftInputMode="adjustResize">
            <intent-filter>
				<action android:name="android.intent.action.MAIN"/>
				<category android:name="android.intent.category.LAUNCHER"/>
				<category android:name="android.intent.category.HOME"/>
				<category android:name="android.intent.category.DEFAULT"/>
			</intent-filter>
			<intent-filter>
				<action android:name="android.intent.action.VIEW"/>
				<category android:name="android.intent.category.DEFAULT"/>
				<category android:name="android.intent.category.BROWSABLE"/>
			</intent-filter>
		</activity>	
    </application>
</manifest>

最后在HBuilderX中提交云打包。

Android原生应用清单文件和资源 | uni-app官网

Android开机自启动方案二 

 这个方案是采用接收广播的方式,启动App会有稍许延迟。

插件地址:安卓开机自启动 Fvv-AutoStart - DCloud 插件市场

  • 14
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值