Zwade
Zwade

Reputation: 1712

Android Manifest for Keyboard not Showing in Settings

I am making my first android app, and I need it to be a keyboard service. As best as I can tell, the manifest looks good, and I have a file, WifiJoy.java (in the com.zwad3.wifijoy package) as well as all other files.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.zwad3.wifijoy"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="9"
        android:targetSdkVersion="15" />
    <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"></uses-permission>
    <uses-permission android:name="android.permission.INTERNET"></uses-permission>
    <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <service android:name="com.zwad3.wifijoy.WifiJoy"
            android:label="Wifi Joystick"
            android:permission="android.permission.BIND_INPUT_METHOD">
            <intent-filter>
                <action android:name="android.view.InputMethod" />
            </intent-filter>
        </service>

        <activity
            android:name=".settings"
            android:label="@string/title_activity_settings" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>

Here is the beginning of WifiJoy.java

package com.zwad3.wifijoy;

import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;
import android.inputmethodservice.InputMethodService;

public class WifiJoy extends InputMethodService {

I know this is incomplete so if you need more info let me know, I just didn't want to overload the post.

Upvotes: 3

Views: 4167

Answers (1)

CommonsWare
CommonsWare

Reputation: 1007296

Try adding a <meta-data> element in your <service>, such as the one shown in this manifest from the SoftKeyboard SDK sample:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
        package="com.example.android.softkeyboard">
    <application android:label="@string/ime_name">
        <service android:name="SoftKeyboard"
                android:permission="android.permission.BIND_INPUT_METHOD">
            <intent-filter>
                <action android:name="android.view.InputMethod" />
            </intent-filter>
            <meta-data android:name="android.view.im" android:resource="@xml/method" />
        </service>

        <activity android:name=".ImePreferences" android:label="@string/settings_name">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
            </intent-filter>
        </activity>

    </application>
</manifest>

That would point to an XML file in res/xml/ (named method.xml in the above sample), that contains descriptive information about your IME, like this file from the same SDK sample:

<input-method xmlns:android="http://schemas.android.com/apk/res/android"
        android:settingsActivity="com.example.android.softkeyboard.ImePreferences"
>
    <subtype
        android:label="@string/label_subtype_generic"
        android:icon="@drawable/icon_en_us"
        android:imeSubtypeLocale="en_US"
        android:imeSubtypeMode="keyboard" />
    <subtype
        android:label="@string/label_subtype_en_GB"
        android:icon="@drawable/icon_en_gb"
        android:imeSubtypeLocale="en_GB"
        android:imeSubtypeMode="keyboard" />
</input-method>

Upvotes: 6

Related Questions