set static user location and geo object location

Forums:

hy admin.

problem 1:

how to set static User position in maps?
i mean, when im in another place, the position change not in the same place like this code.

// User position (you can change it using the GPS listeners form Android
        // API)
        sharedWorld.setGeoPosition(41.26533734214473d, 1.925848038959814d);

it just set in A position, when im going to B position, it just in A, its not moving.
how to make it move?

Problem 2:

when i start the AR, the object was not in the place that i set in code.

im in X place and the object in Y place.

when im moving to Y place, the object is not in Y place, but its moved to another place.
and its moving.

how to make the object stay in the location that i set from longitude and latitude in code?

 

please help

regards

Beyondar's picture

I've created a wiki page explaining how to use the BeyondAR location helper: I'll create an example code when I will get time for it

https://github.com/BeyondAR/beyondar/wiki/Location-helper

kampusunib19's picture

i'll waiting for example code. need it fast. hope you get free time and help me friend :)

regards

Beyondar's picture

Try to follow the wiki, I'm very bussy preparing a conference for BeyondAR and I need to clean up some code, finish the wiki and finish some features. I suggest to try and ask here you questions if you needed ASAP.

I also suggest to read some documentation about how to use location in android, it will help you understanding how it works and what you need.

kampusunib19's picture

okay :)

kampusunib19's picture

but, honestly i really need your help friend. hope you can write the example code asap :D

Beyondar's picture

Did you manage to fix it?

kampusunib19's picture

yes, I am still trying, but it still does not work. hmm

kampusunib19's picture

i've try following this tutorial in wiki about "Loaction Helper"

but, i still cannt make it work.

can you help me give the specific code to solve user location?

https://github.com/BeyondAR/beyondar/wiki/Location-helper#sthash.Vy13yBa...

 

Beyondar's picture

Did you check this url?

It is very easy, just add 

@Override
void onResume(){
    // Enable GPS
    BeyondarLocationManager.enable();
}

In your activity, and the get specify that you want your World to be updated:

void onCreate(Bundle savedInstanceState){
    // ...
    BeyondarLocationManager.setLocationManager((LocationManager)
this.getSystemService(Context.LOCATION_SERVICE)); // ... }
kampusunib19's picture

yes, i have checked.

but it's still contain error.
will you write the full code for the example?

it will imporve BeyondAr as AR browser, i think :)

 

kampusunib19's picture

check this if i false,

i make the code in BeyonarLocationListerner.java

void onResume(){
        // Enable GPS
        BeyondarLocationHelper.enable();
    }

then, in BeyondarExample.java

@Override
    public void onCreate(Bundle savedInstanceState) {
       

BeyondarLocationHelper.setLocationManager((LocationManager) this.getSystemService(Context.LOCATION_SERVICE));


        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        mLisViewt = (ListView) findViewById(R.id.examplesList);

 

 

and when i run the app, nothing's change.

is that the code i placed in the right java?

or i make a false?

please help

and give me a specific clue to make it fix

Beyondar's picture

I've created an example here. When you press the button it shoes what is your location.

kampusunib19's picture

wow. it's perfectly set my place.

graciasss ma friend. :)

i have one question left for making it better AR browser friend,

the object in AR why still close around me. when i start AR camera, the location of object was not in the coordinate place?

can you fix it too?

kampusunib19's picture

in "beyondlocationmanager" menu, there is a button "My Location". it will  better if you make 1 more button with name "Ar Camera". so the user can show maps in their location, then they can show AR object in place  where they looking for.

kampusunib19's picture

what i said like this:

i set my object in "X" place, the X place is far from me. i set my place in "Y"

then when i start AR camera, it will show the location of X from the "Y".

just like in "usingbeyondlocationmanager"menu, in maps the location of user was updated with gps. and its make a real distance of user location and the object.

i hope the object and the location of user in AR Camera is same with the map. so it can make user find the place that they looking for using AR camera as their guide. Make the Object in the real Place in the real World.

hope it can fix. so it can make it better, it will improve BeyondAR be a usefull AR browser ;)

Beyondar's picture

If the object is very far away you will not see it, if you want you can increase the limit for drawing the objects (see here) and then put them close (check out this example)

kampusunib19's picture

how to make geoObject in AR camera stay in their place, not close in Around us?

in beyondAR version now, when whe start AR camera, the objects stay in around us, and when we move, their going to move too. they not stay in their Place (longitute and latitude that we set in world)

when the user open AR camera, how to set the Code in eclipse so that the object didnt move from their place. so user can she the real place of Geoobject that we set in world (their langitute and latitude) and find their (geoObject) real place by following AR camera?

help please :(

kampusunib19's picture

please help. really need help asap

Beyondar's picture

You need to use the BeyondarLocationManager and add the world there, then whe a location is changed BeyondarLocationManager will also update the world and you will see that the objects ar getting farher or closer. 

If you are already using it, try to add a LocationListener to the BeyondarLocationManager and you will see if you are getting new positions when you walk. You also can change the positions in your own LocationListener

kampusunib19's picture

yes, i have done with that case. it's work well in gmaps.

and, how to make it work not only in gmaps, but also in AR Camera?

can you show the example code? and how?

Help please

Beyondar's picture

It is exactly the same thing, if you paste some code I'll be able to se what is wrong

kampusunib19's picture

i make in Simple camera max min distance.java.

it's still error, i paste the same code like in location manager. can you fix it?

/*
 * Copyright (C) 2014 BeyondAR
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.beyondar.example;

import android.content.Context;
import android.location.LocationManager;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.View;
import android.view.Window;
import android.widget.Button;
import android.widget.SeekBar;
import android.widget.SeekBar.OnSeekBarChangeListener;

import com.beyondar.android.fragment.BeyondarFragmentSupport;
import com.beyondar.android.util.location.BeyondarLocationManager;
import com.beyondar.android.world.World;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.model.LatLng;

public class SimpleCameraWithMaxFarMinAwayActivity extends FragmentActivity implements OnSeekBarChangeListener {

    private BeyondarFragmentSupport mBeyondarFragment;
    private World mWorld;

    private SeekBar mSeekBarMax, mSeekBarMin;

    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        // Hide the window title.
        requestWindowFeature(Window.FEATURE_NO_TITLE);
       
        Button myLocationButton = (Button) findViewById(R.id.myLocationButton);

        setContentView(R.layout.simple_camera_with_distance_controlers);
        mSeekBarMax = (SeekBar) findViewById(R.id.seekBarMax);
        mSeekBarMin = (SeekBar) findViewById(R.id.seekBarMin);
        mSeekBarMax.setOnSeekBarChangeListener(this);
        mSeekBarMin.setOnSeekBarChangeListener(this);
        mSeekBarMax.setMax(100);
        mSeekBarMin.setMax(100);

        mBeyondarFragment = (BeyondarFragmentSupport) getSupportFragmentManager().findFragmentById(
                R.id.beyondarFragment);

        // We create the world and fill it ...
        mWorld = CustomWorldHelper.generateObjects(this);
        // .. and send it to the fragment
        mBeyondarFragment.setWorld(mWorld);

        // We also can see the Frames per seconds
        mBeyondarFragment.showFPS(true);
       
       
        BeyondarLocationManager.addWorldLocationUpdate(mWorld);
        BeyondarLocationManager.addGeoObjectLocationUpdate(user);

        // We need to set the LocationManager to the BeyondarLocationManager.
        BeyondarLocationManager
                .setLocationManager((LocationManager) getSystemService(Context.LOCATION_SERVICE));
       

    }

    @Override
    public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
        if (seekBar == mSeekBarMax) {
            mBeyondarFragment.setMaxFarDistance(progress);
        } else if (seekBar == mSeekBarMin) {
            mBeyondarFragment.setMinFarDistanceSize(progress);
        }
    }

    @Override
    public void onStartTrackingTouch(SeekBar seekBar) {
    }

    @Override
    public void onStopTrackingTouch(SeekBar seekBar) {
    }

    @Override
    protected void onResume() {
        super.onResume();
        // When the activity is resumed it is time to enable the
        // BeyondarLocationManager
        BeyondarLocationManager.enable();
    }

    @Override
    protected void onPause() {
        super.onPause();
        // To avoid unnecessary battery usage disable BeyondarLocationManager
        // when the activity goes on pause.
        BeyondarLocationManager.disable();
    }

    @Override
    public void onClick(View v) {
        // When the user clicks on the button we animate the map to the user
        // location
        LatLng userLocation = new LatLng(mWorld.getLatitude(), mWorld.getLongitude());
        mWorld.moveCamera(CameraUpdateFactory.newLatLngZoom(userLocation, 15));
        mWorld.animateCamera(CameraUpdateFactory.zoomTo(19), 2000, null);
    }
   
}

Beyondar's picture

I'll check it out ASAP, but maybe it is a bug.

Beyondar's picture

I've tested and it works. I'm wondering how the code that you post can even compile? if BeyondarLocationManager.addGeoObjectLocationUpdate(user); is using an object that it is not even declared?

kampusunib19's picture

it's still error. can you give me the sample code?

so, when i open simplearcamerawithMax/mindistance.java can detect user location.

please help Asap

kampusunib19's picture

admin, please help xx

Beyondar's picture

Can you upload your project on dropbox or something? than I'll take a look at the project

kampusunib19's picture

im using beyondAr project. how to set 'My Location" button on AR camera like in BeyondArLocationManagerMapActivity.class?

kampusunib19's picture

i've sent my project link to admin@beyondar.com. please check and help