未收到Android启动\u完成
我对安卓系统很陌生:我在网上做了一些实验和研究,但我不知道我的问题来自哪里。。。 我想让我的应用程序接收BOOT_COMPLETE广播消息,但不知为什么,我不想让它工作。Sympot是:它似乎可以在emulator上启动或使用命令未收到Android启动\u完成,android,bootcompleted,Android,Bootcompleted,我对安卓系统很陌生:我在网上做了一些实验和研究,但我不知道我的问题来自哪里。。。 我想让我的应用程序接收BOOT_COMPLETE广播消息,但不知为什么,我不想让它工作。Sympot是:它似乎可以在emulator上启动或使用命令 shell am broadcast -a android.intent.action.BOOT_COMPLETED -n <myapp>/.BootReceiver 因此,我想请求一些帮助,欢迎任何提示 这是我的舱单: <?xml version
shell am broadcast -a android.intent.action.BOOT_COMPLETED -n <myapp>/.BootReceiver
因此,我想请求一些帮助,欢迎任何提示
这是我的舱单:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.eds.testtvapp">
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
<uses-feature
android:name="android.software.leanback"
android:required="true" />
<application
android:allowBackup="true"
android:banner="@mipmap/ic_launcher"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".MainActivity">
android:name=".ConfigActivity"
android:theme="@style/Theme.Leanback">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name=".BootReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.REBOOT" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<action android:name="com.htc.intent.action.QUICKBOOT_POWERON" />
<action android:name="android.intent.action.USER_PRESENT" />
</intent-filter>
</receiver>
</application>
</manifest>
我的主要活动(唯一一项)
我的build.gradle文件
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.eds.testtvapp"
minSdkVersion 24
targetSdkVersion 29
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.leanback:leanback:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0'
}
而且,为了完成my styles.xml
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="@style/Theme.Leanback" />
</resources>
和strings.xml
<resources>
<string name="app_name">TestTVApp</string>
<string name="app_data">APPLICATION_DATA</string>
<string name="app_data_start">FROM_BOOT</string>
<string name="config_switch_selection">TOAST_OR_SNACK</string>
<string name="config_switch_Default">false</string>
</resources>
测试电视应用程序
应用程序数据
从你的靴子
烤面包或零食
假的
就我所见,实现接收这个广播消息(就代码而言)没有什么不对的。
任何暗示都欢迎
谢谢
apply plugin: 'com.android.application'
android {
compileSdkVersion 29
defaultConfig {
applicationId "com.eds.testtvapp"
minSdkVersion 24
targetSdkVersion 29
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'androidx.leanback:leanback:1.0.0'
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
implementation 'com.google.android.material:material:1.1.0'
}
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="@style/Theme.Leanback" />
</resources>
<resources>
<string name="app_name">TestTVApp</string>
<string name="app_data">APPLICATION_DATA</string>
<string name="app_data_start">FROM_BOOT</string>
<string name="config_switch_selection">TOAST_OR_SNACK</string>
<string name="config_switch_Default">false</string>
</resources>