Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Daydream settings

Tags:

android

I'm trying to create a settings for my Daydream and according to the documentation, I need to create a xml file, like this:

 <dream xmlns:android="http://schemas.android.com/apk/res/android"
 android:settingsActivity="com.example.app/.MyDreamSettingsActivity" />

However, my Activity is in a library project (called com.project.base) and I keep getting this error in Logcat when clicking on the setting button:

 11-16 23:01:29.331: E/AndroidRuntime(28908): android.content.ActivityNotFoundException: Unable to find explicit activity class {com.project.base/com.project.base.SettingsDayDream}; have you declared this activity in your AndroidManifest.xml?

I have my xml file setup like this:

 <dream xmlns:android="http://schemas.android.com/apk/res/android"
 android:settingsActivity="com.project.base/.SettingsDayDream" />

but I've tried all variation, such as com.project.base/com.project.base.SettingsDayDream and just com.project.base.SettingsDayDream, but nothing seems to work.

I've declared the activity in the AndroidManifest.xml like this:

    <activity android:name="com.project.base.SettingsDayDream" android:configChanges="keyboardHidden|orientation" />

as well as the service:

<service android:name="com.project.base.DayDream" android:exported="true" android:icon="@drawable/icon" android:label="@string/app_name">
    <intent-filter>
    <action android:name="android.service.dreams.DreamService" />
        <category android:name="android.intent.category.DEFAULT" />
    </intent-filter>
    <meta-data android:name="android.service.dream" android:resource="@xml/daydream" />
</service>
like image 830
Kris B Avatar asked Oct 05 '22 23:10

Kris B


1 Answers

The problem is in your daydream.xml. The format for the android:settingsActivity is current.app.package/com.project.base.SettingsActivity

So current.app.package, before the /, needs to be your current app, not the library project.

like image 79
TalkLittle Avatar answered Oct 10 '22 04:10

TalkLittle