android - 将 Google Maps API 实现到 Google Glass 时出错

标签 android google-maps google-glass google-gdk

注意:我们是在 Glass 上运行它,而不是模拟它

所以,当我包括:

<uses-library android:name="com.google.android.maps"/>

在 list 文件中。我收到错误:

Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY

因此,如果我删除 list 中的行,应用程序将在到达 map Activity 时崩溃,该 Activity 显示为:

package com.example.mapping;
import android.app.Activity;
import com.google.android.gms.maps.*;
import com.google.android.gms.maps.model.*;
import android.app.Activity;
import android.os.Bundle;
import android.app.ActionBar;
import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.os.Build;

public class MapActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_map);

    // Get a handle to the Map Fragment
    GoogleMap map = ((MapFragment) getFragmentManager()
            .findFragmentById(R.id.mapView)).getMap();

    LatLng war = new LatLng(-33.867, 151.206);

    map.setMyLocationEnabled(true);
    map.moveCamera(CameraUpdateFactory.newLatLngZoom(war, 13));

    map.addMarker(new MarkerOptions()
            .title("Mission Drop Zone")
            .snippet("Navigate to Enemy Hideout")
            .position(war));



}

@Override
public boolean onCreateOptionsMenu(Menu menu) {

    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.map, menu);
    return true;
}

@Override
public boolean onOptionsItemSelected(MenuItem item) {
    // Handle action bar item clicks here. The action bar will
    // automatically handle clicks on the Home/Up button, so long
    // as you specify a parent activity in AndroidManifest.xml.
    int id = item.getItemId();
    if (id == R.id.mapView) {
        return true;
    }
    return super.onOptionsItemSelected(item);
}

/**
 * A placeholder fragment containing a simple view.
 */
public static class PlaceholderFragment extends Fragment {

    public PlaceholderFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
            Bundle savedInstanceState) {
        View rootView = inflater.inflate(R.layout.fragment_map, container,
                false);
        return rootView;
    }
}}

最佳答案

据我了解,Google map 需要 Google Play 服务。目前,谷歌眼镜仍未正式提供 Google Play 服务。另外要注意的是,Glass 没有设备上的 GPS,它实际上使用手机中的 GPS 进行高精度定位。

关于android - 将 Google Maps API 实现到 Google Glass 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24164462/

相关文章:

python - 是否可以使用 Jupyter Notebooks 禁用/隐藏 gmap 中的控件?

android - 标记消失

google-app-engine - 未找到 API 包 'urlfetch' 或调用 'Fetch()'

android - 如何检测 livecard 中的手势

python - 将多张卡片发布到时间线并附加视频时超出了截止日期

CMake 构建工具链中 "strip"命令的 Android NDK 路径变量

Android Studio : Neither path nor baseDir may be null or empty string. 路径 ='null' basedir ='/Users/.../app'

javascript - 关闭谷歌地图 infowindow.open(map) 异步行为

android - 为什么我的 IntentService 不需要 WakeLock?

android - 是否可以声明一个APK依赖于另一个APK并自动安装依赖的APK