Android Things to Download

When I reboot after deploying the application to Android Things , the application does not start.

Is there a specific intention to run the application at boot time?

+4
source share
4 answers

If you have multiple apps installed on your Android Things device , everyone has a filter of this intent in the manifest:

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

(<DP8 use IOT_LAUNCHERthat is out of date)

, Intent Chooser, , , . ( , , , . , , .)

script : https://gist.github.com/blundell/7c0c3bb17898b28fe8122b0dc230af50, , Intent Filter, 1 - .

script to remove example


AndroidThings IntentChooser , , , - .

+12

AndroidManifest.xml

intent-filter
<intent-filter>
   <action android:name="android.intent.action.MAIN"/>
   <category android:name="android.intent.category.IOT_LAUNCHER"/>
   <category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
+3

-? , , . . , .

AndroidManifest.xml .

<!-- Launch activity automatically on boot -->
<intent-filter>
    <action android:name="android.intent.action.MAIN"/>
    <category android:name="android.intent.category.IOT_LAUNCHER"/>
    <category android:name="android.intent.category.DEFAULT"/>
</intent-filter>
+2

Android Things , .

When adding an intent filter for an action, an intent filter must be installed that includes both CATEGORY_DEFAULTand IOT_LAUNCHER.

<application
android:label="@string/app_name">
<activity android:name=".HomeActivity">
    <!-- Launch activity as default from Android Studio -->
    <!-- For ease of development, this same activity should include a CATEGORY_LAUNCHER intent filter so Android Studio can launch it as the default activity when deploying or debugging. -->
    <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.LAUNCHER"/>
    </intent-filter>

    <!-- Add below intent filter which enable android things support for app -->
    <!-- Launch activity automatically on boot -->
    <intent-filter>
        <action android:name="android.intent.action.MAIN"/>
        <category android:name="android.intent.category.IOT_LAUNCHER"/>
        <category android:name="android.intent.category.DEFAULT"/>
    </intent-filter>
</activity>

Check Main Support Activity for Android Things in the Android app.

0
source

Source: https://habr.com/ru/post/1663652/


All Articles