Sample Code

Sarah Blaszak -

Below is the full source code for the Android Activity created in the Getting Started guide.

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import com.trx.neon.api.Neon;
import com.trx.neon.api.INeonLocationListener;
import com.trx.neon.model.DeviceLocation;

public class MainActivity 
    extends Activity 
    implements INeonLocationListener
{
    @Override
    public void onLocationChanged(DeviceLocation location) 
    {
        Log.i("MyFirstLocation", location.toString());
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) 
    {
        super.onCreate(savedInstanceState);
        Neon.registerLocationUpdates(this);
    }

    @Override
    protected void onStart()
    {
        super.onStart();
        Neon.bind(this.getApplicationContext());
    }

    @Override
    protected void onStop()
    {
        super.onStop();
        Neon.unbind();
    }
}

 

Have more questions? Submit a request

Comments

Powered by Zendesk