Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[Q] Implement Maps API on Glass?

OP deevu

11th June 2014, 05:15 PM   |  #1  
OP Junior Member
Thanks Meter: 0
 
3 posts
Join Date:Joined: Mar 2011
Has anyone been able to successfully implement the google Maps API on Glass? I am having an issue regarding the manifest xml file.

So, the problem arises when I include:

Code:
<uses-library android:name="com.google.android.maps"/>
in the Manifest file. I get the error:

Code:
Installation error: INSTALL_FAILED_MISSING_SHARED_LIBRARY
So if I remove the line in the manifest, the application will crash upon getting to the map activity which reads:

Main_Activity if needed:
Code:
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;
    }
}
}


If you require my AndroidManifest let me know. It is not letting me post it because it thinks it is a link to an external page.

Thanks for any help
12th June 2014, 03:50 PM   |  #2  
OP Junior Member
Thanks Meter: 0
 
3 posts
Join Date:Joined: Mar 2011
Solved.
Turns out that glass has limited or no integration with google play services, as a result google maps api is irrelevant. I have solved my issue by integrating MapQuest rather than google maps, and have found it to be much easier to implement into a glass app than trying to hack a maps api integration. Hope this helps anyone else that has had this issue.
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes