不是Activity子类或别名

时间:2016-12-14 04:12:21

标签: android

您好我想尝试这样做:if ($this->request->is('post') || $this->request->is('put'))

但出于某些原因我得到了: 运行app时出错:services.BackgroundService不是Activity子类或别名

Android新手......

https://technology.jana.com/2014/10/28/periodic-background-tasks-in-android/

这是我要求的服务代码:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mycompany.app">

<application
    android:name=".Virgo">

    <receiver android:name="receivers.SyncReceiver">
        <intent-filter>
            <action android:name="android.intent.action.BATTERY_LOW" />
            <action android:name="android.intent.action.BATTERY_OKAY" />
            <action android:name="com.mycompany.app.SYNC_TASK_HEART_BEAT" />
        </intent-filter>
    </receiver>

    <receiver android:name="receivers.BootAndUpdateReceiver">
        <intent-filter>
            <action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
            <action android:name="android.intent.action.BOOT_COMPLETED" />
        </intent-filter>
    </receiver>

    <service android:name="services.BackgroundService" />

</application>

}

1 个答案:

答案 0 :(得分:3)

运行/调试配置中的配置错误&gt;启动时,有一个活动在那里,并且与清单不匹配!