GoogleApiClient - 无法启动服务

时间:2015-04-24 08:18:27

标签: android google-play-services android-service google-api-client

我试图将LocationUpdate作为服务(来自Play Services v7),我有这样的错误:

Unable to start service com.package.etcetc... GoogleApiClient is not connected yet.

enter image description here

这是我的机器清单:

...
<application
    android:allowBackup="true"
    android:icon="@mipmap/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme">
    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

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

MainActivity调用服务:

startService(new Intent(MainActivity.this, LocationService.class));

这是我的完整java代码:http://pastebin.com/hgjKKmMr

有任何建议吗?

0 个答案:

没有答案
相关问题