void Start()
    {
        /*if (!PlaybackManager.Instance.playback)
         * {
         *  UpdateLocation(12.4444, 12.4434, 0f, 1f);
         *  UpdateLocation(12.4434, 12.4404, 0f, 1f);
         *  UpdateLocation(12.4424, 12.4414, 0f, 1f);
         *  UpdateLocation(12.4414, 12.4424, 0f, 1f);
         *  UpdateLocation(12.4464, 12.4484, 0f, 1f);
         *  UpdateLocation(12.4474, 12.4474, 0f, 1f);
         *  UpdateLocation(12.4484, 12.4454, 0f, 1f);
         *  UpdateLocation(12.4494, 12.4424, 0f, 1f);
         *  UpdateLocation(12.4444, 12.4484, 0f, 1f);
         *  UpdateLocation(12.4434, 12.4474, 0f, 1f);
         *  UpdateLocation(12.4464, 12.4464, 0f, 1f);
         *  UpdateLocation(12.4424, 12.4454, 0f, 1f);
         *  UpdateLocation(12.4474, 12.4434, 0f, 1f);
         * }*/
        calcButton.onClick.AddListener(CalculateAndDisplay);

        if (PlaybackManager.Instance.playback)
        {
            collect = false;
            LoadData();
            SetupPlayback();
        }
        else if (Input.location.isEnabledByUser)
        {
            calcButton.onClick.AddListener(CalculateAndDisplay);
            callback = new AndroidGPSServiceCallback();
            callback.OnUpdateLocation += UpdateLocation;
            // Get the unity android activity
            AndroidJavaObject activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic <AndroidJavaObject>("currentActivity");
            _serviceLauncher = new AndroidJavaClass("com.pocketbike.gpstrackingservice.ServiceLauncher");
            _serviceLauncher.CallStatic("setActivityInstance", activity);
            _gpsServiceActive = _serviceLauncher.CallStatic <bool>("startService", callback);
        }
    }
Example #2
0
    private void Awake()
    {
#if !UNITY_EDITOR
        callback = new AndroidGPSServiceCallback();
#endif
    }