{"action":"created","issue":{"url":"https://api.github.com/repos/kontaktio/Android-SDK/issues/80","labels_url":"https://api.github.com/repos/kontaktio/Android-SDK/issues/80/labels{/name}","comments_url":"https://api.github.com/repos/kontaktio/Android-SDK/issues/80/comments","events_url":"https://api.github.com/repos/kontaktio/Android-SDK/issues/80/events","html_url":"https://github.com/kontaktio/Android-SDK/issues/80","id":127415576,"number":80,"title":"Beacons Update Info - Program Performance","user":{"login":"BGomes17","id":11064243,"avatar_url":"https://avatars.githubusercontent.com/u/11064243?v=3","gravatar_id":"","url":"https://api.github.com/users/BGomes17","html_url":"https://github.com/BGomes17","followers_url":"https://api.github.com/users/BGomes17/followers","following_url":"https://api.github.com/users/BGomes17/following{/other_user}","gists_url":"https://api.github.com/users/BGomes17/gists{/gist_id}","starred_url":"https://api.github.com/users/BGomes17/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BGomes17/subscriptions","organizations_url":"https://api.github.com/users/BGomes17/orgs","repos_url":"https://api.github.com/users/BGomes17/repos","events_url":"https://api.github.com/users/BGomes17/events{/privacy}","received_events_url":"https://api.github.com/users/BGomes17/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-01-19T10:31:36Z","updated_at":"2016-01-19T11:13:16Z","closed_at":null,"body":"Hi, I'm trying to develop a project that will measure the distance from the mobile phone to the beacons.\r\nAs I am testing the results I'm not really happy with them. I notice that sometimes the beacon updates its information really slow, and if i'm moving far or near the beacon, the update of the distance it's happening with a delay. So sometimes I'm near the beacon and when I move away, the distance still says I'm close to the beacon or vise versa. \r\nSo I created a simple activity to just test the results filtering the scan results to just show me a specific beacon. Even with this I think it could (should) be faster. Here's my code:\r\n\r\n```java\r\nimport com.kontakt.sdk.android.ble.configuration.ActivityCheckConfiguration;\r\nimport com.kontakt.sdk.android.ble.configuration.ForceScanConfiguration;\r\nimport com.kontakt.sdk.android.ble.configuration.scan.EddystoneScanContext;\r\nimport com.kontakt.sdk.android.ble.configuration.scan.IBeaconScanContext;\r\nimport com.kontakt.sdk.android.ble.configuration.scan.ScanContext;\r\nimport com.kontakt.sdk.android.ble.connection.OnServiceReadyListener;\r\nimport com.kontakt.sdk.android.ble.device.DeviceProfile;\r\nimport com.kontakt.sdk.android.ble.discovery.BluetoothDeviceEvent;\r\nimport com.kontakt.sdk.android.ble.discovery.EventType;\r\nimport com.kontakt.sdk.android.ble.discovery.eddystone.EddystoneDeviceEvent;\r\nimport com.kontakt.sdk.android.ble.filter.eddystone.EddystoneFilters;\r\nimport com.kontakt.sdk.android.ble.manager.ProximityManager;\r\nimport com.kontakt.sdk.android.ble.rssi.RssiCalculators;\r\nimport com.kontakt.sdk.android.ble.util.BluetoothUtils;\r\nimport com.kontakt.sdk.android.common.profile.IEddystoneDevice;\r\n\r\nimport java.util.ArrayList;\r\nimport java.util.Arrays;\r\nimport java.util.List;\r\n\r\n\r\npublic class TestActivity extends Activity implements ProximityManager.ProximityListener {\r\n\r\n    private static final int REQUEST_CODE_ENABLE_BLUETOOTH = 1;\r\n\r\n    private ProximityManager deviceManager;\r\n    public ScanContext scanContext;\r\n\r\n    private List<EventType> eventTypes = new ArrayList<EventType>() {{\r\n        add(EventType.DEVICES_UPDATE);\r\n    }};\r\n\r\n    private EddystoneScanContext eddystoneScanContext = new EddystoneScanContext.Builder()\r\n            .setEventTypes(eventTypes)\r\n            .setUIDFilters(Arrays.asList(\r\n                    EddystoneFilters.newUIDFilter(\"f7826da6bc5b71e0893e\", \"62347a713348\")\r\n            ))\r\n            .setRssiCalculator(RssiCalculators.newLimitedMeanRssiCalculator(5))\r\n            .build();\r\n\r\n\r\n    @Override\r\n    protected void onCreate(Bundle savedInstanceState) {\r\n        super.onCreate(savedInstanceState);\r\n        setContentView(R.layout.activity_test);\r\n\r\n        deviceManager = new ProximityManager(this);\r\n\r\n    }\r\n\r\n    public void startScan() {\r\n\r\n        deviceManager.initializeScan(getOrCreateScanContext(), new OnServiceReadyListener() {\r\n            @Override\r\n            public void onServiceReady() {\r\n\r\n                deviceManager.attachListener(TestActivity.this);\r\n            }\r\n\r\n            @Override\r\n            public void onConnectionFailure() {\r\n                Log.i(\"Scan\", \"startScan(): Erro conexão\");\r\n            }\r\n        });\r\n\r\n    }\r\n\r\n    public ScanContext getOrCreateScanContext() {\r\n        if (scanContext == null) {\r\n            scanContext = new ScanContext.Builder()\r\n                    .setScanMode(ProximityManager.SCAN_MODE_BALANCED)\r\n                    .setEddystoneScanContext(eddystoneScanContext)\r\n                    .setActivityCheckConfiguration(ActivityCheckConfiguration.DEFAULT)\r\n                    .setForceScanConfiguration(ForceScanConfiguration.DEFAULT)\r\n                    .build();\r\n        }\r\n\r\n        return scanContext;\r\n    }\r\n\r\n\r\n    @Override\r\n    public void onScanStart() {\r\n\r\n    }\r\n\r\n    @Override\r\n    public void onScanStop() {\r\n\r\n    }\r\n\r\n    @Override\r\n    public void onEvent(BluetoothDeviceEvent event) {\r\n        switch (event.getEventType()) {\r\n            case DEVICES_UPDATE:\r\n                onDevicesUpdateEvent(event);\r\n                break;\r\n        }\r\n    }\r\n    public void onDevicesUpdateEvent(BluetoothDeviceEvent event) {\r\n        DeviceProfile deviceProfile = event.getDeviceProfile();\r\n        switch (deviceProfile) {\r\n            case EDDYSTONE:\r\n                onEddystoneDevicesList((EddystoneDeviceEvent) event);\r\n                break;\r\n        }\r\n    }\r\n\r\n    @Override\r\n    protected void onResume() {\r\n        super.onResume();\r\n\r\n        if (!BluetoothUtils.isBluetoothEnabled()) {\r\n            final Intent intent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);\r\n            startActivityForResult(intent, REQUEST_CODE_ENABLE_BLUETOOTH);\r\n        } else {\r\n            startScan();\r\n        }\r\n    }\r\n\r\n    @Override\r\n    protected void onPause() {\r\n        super.onPause();\r\n\r\n        deviceManager.finishScan();\r\n    }\r\n\r\n    private void onEddystoneDevicesList(final EddystoneDeviceEvent event) {\r\n\r\n        Log.i(\"Scan\", \"onEddystoneDevicesList()\");\r\n        List<IEddystoneDevice> eddystoneDevices = event.getDeviceList();\r\n\r\n        for (IEddystoneDevice eddystoneDevice : eddystoneDevices) {\r\n            TextView distanceTextView = (TextView) findViewById(R.id.text);\r\n            Log.i(\"Scan\", \"onEddystoneDevicesList(): device\" + eddystoneDevice.getInstanceId());\r\n            distanceTextView.setText(eddystoneDevice.getDistance() + \"\");\r\n        }\r\n\r\n\r\n    }\r\n}\r\n\r\n```\r\n\r\nMy question is: is there anything I could do to make it faster?"},"comment":{"url":"https://api.github.com/repos/kontaktio/Android-SDK/issues/comments/172820221","html_url":"https://github.com/kontaktio/Android-SDK/issues/80#issuecomment-172820221","issue_url":"https://api.github.com/repos/kontaktio/Android-SDK/issues/80","id":172820221,"user":{"login":"BGomes17","id":11064243,"avatar_url":"https://avatars.githubusercontent.com/u/11064243?v=3","gravatar_id":"","url":"https://api.github.com/users/BGomes17","html_url":"https://github.com/BGomes17","followers_url":"https://api.github.com/users/BGomes17/followers","following_url":"https://api.github.com/users/BGomes17/following{/other_user}","gists_url":"https://api.github.com/users/BGomes17/gists{/gist_id}","starred_url":"https://api.github.com/users/BGomes17/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BGomes17/subscriptions","organizations_url":"https://api.github.com/users/BGomes17/orgs","repos_url":"https://api.github.com/users/BGomes17/repos","events_url":"https://api.github.com/users/BGomes17/events{/privacy}","received_events_url":"https://api.github.com/users/BGomes17/received_events","type":"User","site_admin":false},"created_at":"2016-01-19T11:13:16Z","updated_at":"2016-01-19T11:13:16Z","body":"I'm using LG G3 with Android 5.0 and LG G4 with 5.1. \r\nWith both of this devices I'm getting approximately the same response."}}