Search code examples
androidcameraaugmented-realitydirection

find restaurents and tourist places by augmented reality


in my app i want to use augmented reality to find places like family restaurants etc.. What i want to do is that when i start my app camera turned on and then i want to locate the places in the direction of the camera .for example i start the app and i m facing the east and phone keypad is facing towards me i.e west,then the places which are in east direction. i have written some code which starts the camera, please suggest any api available for this task and example and tutorial to do that .thanks in advance. here is my code.

@Override
    public void onCreate(Bundle savedInstanceState) {
        // try{

        super.onCreate(savedInstanceState);


sensorMan = (SensorManager) getSystemService(Context.SENSOR_SERVICE);

        sensorMan.registerListener(this,sensorMan.getDefaultSensor(SensorManager.SENSOR_ORIENTATION),
    SensorManager.SENSOR_DELAY_FASTEST);
        //lastUpdate = System.currentTimeMillis();

sensorMan.registerListener(this, sensorMan.getDefaultSensor(Sensor.TYPE_ACCELEROMETER), 
                SensorManager.SENSOR_DELAY_NORMAL);
    }//end of oncreate

@Override
    public void onAccuracyChanged(Sensor sensor, int accuracy) {
        // TODO Auto-generated method stub

    }

    @Override
    public void onSensorChanged(SensorEvent event) {
        // TODO Auto-generated method stub



        if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {

Toast.makeText(this, "X-rawDirection->"+event.values[0], Toast.LENGTH_SHORT).show();
Toast.makeText(this, "Y-rawDirection->"+event.values[1], Toast.LENGTH_SHORT).show();
Toast.makeText(this, "Z-rawDirection->"+event.values[2], Toast.LENGTH_SHORT).show();

            }

            if (event.sensor.getType() == Sensor.TYPE_ORIENTATION) {

    Toast.makeText(this, "X-rawDirection TYPE_ORIENTATION->"+event.values[0], Toast.LENGTH_SHORT).show();
    Toast.makeText(this, "Y-rawDirection TYPE_ORIENTATION->"+event.values[1], Toast.LENGTH_SHORT).show();
    Toast.makeText(this, "Z-rawDirection TYPE_ORIENTATION->"+event.values[2], Toast.LENGTH_SHORT).show();

            }

        }
}

Solution

  • Here is the important link.

    http://code.google.com/apis/maps/documentation/places/

    now all i need to do is the parse the xml file and get the places..