dashclock扩展无法正常工作

时间:2013-09-27 09:51:31

标签: android dashclock

我尝试创建一个dashclock扩展。扩展的活动工作正常,但是我看不到dashclock小部件中的图标,而且我发现服务没有运行(在dasclock java类的onInitialize方法中我写了一个日志,当我执行时从不写入那里)。我不知道最明显的是不是好的。请问你能帮帮我吗? 我最明显的是:

    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="es.defekas.horoscopodash"
    android:versionCode="1"
    android:versionName="1.0" >
    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="18" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
    <uses-permission android:name="android.permission.INTERNET"/>

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >

        <service
            android:name=".dash"     
            android:icon="@drawable/ic_extension_dial"               
            android:label="DashClock Horoscopo"
            android:permission="com.google.android.apps.dashclock.permission.READ_EXTENSION_DATA" >
            <intent-filter>
                <action android:name="com.google.android.apps.dashclock.Extension" />
            </intent-filter>

            <meta-data
                android:name="protocolVersion"
                android:value="1" />
            <meta-data
                android:name="description"
                android:value="Es el mejor complemento del mundo" />
            <!-- A settings activity is optional -->
            <meta-data
                android:name="settingsActivity"
                android:value=".principal" />
        </service>

          <activity
            android:name=".principal"
            android:exported="true"
            android:label="DashClock Horoscopo" />

   <!--'       <activity android:name=".principal"
              android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>   '-->

    </application>


</manifest>

非常感谢和抱歉我的英语!

服务代码:

public class dash extends DashClockExtension {
   // Acción del Intent que abre los resultados al pulsar la extensión
public static final String ACTION_RESULTS = "es.defekas.horoscopodash.OPEN";
private SharedPreferences mPrefs;
// Clave de las Shared Preferences, almacena el texto que queremos buscar
public static final String QUERY = "query";
@Override

protected void onInitialize(boolean isReconnect) {
    /*
     * Aquí llamaríamos a setUpdateWhenScreenOn(boolean) o addWatchContentUris(String[]) si quisiéramos usar dichas funciones.
     * En este caso no lo hacemos
     */
    Log.d("DEFEKAS","=============================================================================");

}
protected void onUpdateData(int arg0) {
    // TODO Auto-generated method stub
    Log.d("DEFEKAS","YA ESTAMOS EN EL DASH Y EL VALOR DEL BLOQUEO ES .....");

    // Creamos el objeto ExtensionData que rellenaremos con los datos que queremos mostrar en el Widget
    ExtensionData data = new ExtensionData();
    data.icon(R.drawable.horoscopes);
    data.clickIntent(new Intent(ACTION_RESULTS));

    try {
        // Hacemos la búsqueda en Twitter. Esto es independiente de nuestra extensión

        data.visible(true);           
        data.status();

        String correo = mPrefs.getString("signo", "No hay signo asociado");
        Log.d("DEFEKAS","YA ESTAMOS EN EL DASH Y EL VALOR DEL BLOQUEO ES ....." + correo);

        data.expandedTitle(correo);

       // tarea ejecucion = new tarea();           
       // ejecucion.execute(correo);

        data.expandedBody();

       // data.expandedBody(String.format(getString(R.string.extension_content_body), busqueda));

    } catch (Exception e) {

        data.visible(true)
                .expandedTitle(e.getClass().getCanonicalName())
                .expandedBody(e.getMessage())
                .status("ERROR");
    }

    // Y finalmente le decimos al Widget que actualice los datos
    publishUpdate(data);
    }

}

0 个答案:

没有答案