Giter Site home page Giter Site logo

adriancretu / beacons-android Goto Github PK

View Code? Open in Web Editor NEW
115.0 115.0 33.0 370 KB

Android BLE advertising library

License: Apache License 2.0

Java 100.00%
advertising android-library beacon ble bluetooth-low-energy broadcast-bluetooth-beacons eddystone-beacons eddystone-eid eddystone-gatt eddystone-uid eddystone-url eid-beacon gatt-service

beacons-android's People

Contributors

adriancretu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

beacons-android's Issues

EID advertising data different

Hi:
I have create a eddystone EID advertising with setting identitykey, exponent and clockOffset, but when
i scan it with another device and found it is different with the data what i set to it. for example, i set the exponent 9 but the eid i receive is -26.

Is it UTF8 encoded or base 64?

I am using to publish iBeacons, But i don't know in what format this library encodes it.
While I am trying to scan it by Google NearBy, I am not able to read it.
As Google NearBy Doc Says.

mMessageListener = new MessageListener() {
    @Override
    public void onFound(Message message) {
        // Do something with the message here.
        Log.i(TAG, "Message found: " + message);
        Log.i(TAG, "Message string: " + new String(message.getContent()));
        Log.i(TAG, "Message namespaced type: " + message.getNamespace() +
                "/" + message.getType());
    }

    ...
};
Parsing the content depends on the format of the bytes. This example assumes that the content bytes encode a UTF-8 string, but your beacon message can encode other byte formats (for example a serialized protocol buffer)

So when I am trying to Log the above method provided by Google Nearby Messages API.

bytes
msg_cntnt

Android 8 support

I am trying to use the library to broadcast a Beacon from my Google Pixel XL running Android 8.1. I am facing two issues:

  • My sample app was initially targeting SDK 26. Because of the use of Services and Broadcast Receivers that haven't been ported to support the new Oreo, the notification that a beacon is broadcasting wasn't showing up. Targeting SDK 25 in my sample app helped solving this issue.
  • Even after that, I couldn't get my Samsung Galaxy S8, running Android 7 to detect my beacon. Listening to events on the Pixel XL, I receive EVENT_ADVERTISER_ADDED followed by a EVENT_ADVERTISER_STARTED and that's it, nothing to indicate an error. Logcat has a few BLE related errors that might be relevant. Note that if I run my sample app on the Galaxy S8, then my Pixel can successfully detect the beacon. I tried to reproduce on another S8 and had same results, indicating the issue seems to be with the Pixel XL.

Logcat excerpt:

01-02 11:10:00.182 1326-1794/? W/bt_btif: bta_gattc_conn_cback() - cif=3 connected=0 conn_id=3 reason=0x0100
01-02 11:10:00.182 1326-1794/? W/bt_btif: bta_gattc_conn_cback() - cif=4 connected=0 conn_id=4 reason=0x0100
01-02 11:10:00.182 1326-1794/? W/bt_btif: bta_gattc_conn_cback() - cif=6 connected=0 conn_id=6 reason=0x0100
01-02 11:10:00.183 1326-1794/? W/bt_btif: bta_gattc_conn_cback() - cif=7 connected=0 conn_id=7 reason=0x0100
01-02 11:10:00.183 1326-1794/? W/bt_btif: bta_gattc_conn_cback() - cif=8 connected=0 conn_id=8 reason=0x0100
01-02 11:10:00.185 2153-2673/? D/BluetoothGattServer: onServerConnectionState() - status=0 serverIf=5 device=E0:49:D9:C3:F7:C9
01-02 11:10:00.187 7708-7720/? D/BluetoothGatt: onClientConnectionState() - status=133 clientIf=8 device=E0:49:D9:C3:F7:C9
01-02 11:10:00.204 7708-7852/? D/BluetoothGatt: cancelOpen() - device: E0:49:D9:C3:F7:C9
01-02 11:10:00.207 1326-1794/? E/bt_btif: No such connection need to be cancelled
01-02 11:10:00.208 1326-1794/? E/bt_stack: [ERROR:bta_gattc_utils.cc(509)] bta_gattc_mark_bg_conn unable to find the bg connection mask for: e0:49:d9:c3:f7:c9
01-02 11:10:00.218 7708-7852/? D/BluetoothGatt: close()
01-02 11:10:00.218 7708-7852/? D/BluetoothGatt: unregisterApp() - mClientIf=8
01-02 11:10:00.219 7708-7961/? D/BluetoothGatt: connect() - device: D6:11:68:96:F7:7D, auto: false
01-02 11:10:00.219 7708-7961/? D/BluetoothGatt: registerApp()
01-02 11:10:00.220 7708-7961/? D/BluetoothGatt: registerApp() - UUID=8441d0b4-251f-4c79-b1f0-7a5cd3306cc6
01-02 11:10:00.224 1326-1794/? I/bt_stack: [INFO:gatt_api.cc(1004)] GATT_Register
01-02 11:10:00.225 1326-1794/? I/bt_stack: [INFO:gatt_api.cc(1027)] allocated gatt_if=8
01-02 11:10:00.231 7708-7720/? D/BluetoothGatt: onClientRegistered() - status=0 clientIf=8
01-02 11:10:00.236 1326-1794/? I/bt_stack: [INFO:gatt_api.cc(1168)] GATT_Connectgatt_if=8 d6:11:68:96:f7:7d
01-02 11:10:01.951 887-1560/? I/WifiService: releaseMulticastLock uid=10156
01-02 11:10:02.525 7708-7708/? D/BluetoothManager: getConnectedDevices
01-02 11:10:02.531 2519-2519/? I/BgTaskExecutorImpl: Starting EXCLUSIVE background task send_pending_events_to_clearcut.
01-02 11:10:02.554 2519-2519/? W/SearchService: Abort, client detached.
01-02 11:10:02.555 2519-11929/? I/EventLogSendingHelper: Sending log events.
01-02 11:10:02.590 2153-5407/? I/Places: ?: PlacesBleScanner stop()
01-02 11:10:02.591 2153-2153/? I/BeaconBle: Places requested to stop scan
01-02 11:10:02.597 2153-2153/? I/BeaconBle: Scan canceled successfully.
01-02 11:10:02.606 2153-5407/? I/PlaceInferenceEngine: [anon] Changed inference mode: 105
01-02 11:10:04.564 887-2347/? I/ActivityManager: Killing 9150:com.facebook.katana/u0a296 (adj 906): empty #17```

feature query

This is not actually an issue, but just a question.
I am trying to set some flags on an Advertisement data for my app.
For example , LE limited Discoverable mode as seen here:

1A # Flags value 0x1A = 000011010
bit 0 (OFF) LE Limited Discoverable Mode
bit 1 (ON) LE General Discoverable Mode
bit 2 (OFF) BR/EDR Not Supported
bit 3 (ON) Simultaneous LE and BR/EDR to Same Device Capable (controller)
bit 4 (ON) Simultaneous LE and BR/EDR to Same Device Capable (Host)
default Android BLE library does not allow that. Can I use this library to set these flags ?
if possible, how ?
if not, could it be possible by wrapping the Advertiser part of the Android BLE library ?

"Limit exceed; cannot create more channels"

Hello, we have recently been getting this crash message:

java.lang.IllegalStateException: Limit exceed; cannot create more channels
	at android.os.Parcel.createExceptionOrNull(Parcel.java:2394)
	at android.os.Parcel.createException(Parcel.java:2370)
	at android.os.Parcel.readException(Parcel.java:2353)
	at android.os.Parcel.readException(Parcel.java:2295)
	at android.app.INotificationManager$Stub$Proxy.createNotificationChannels(INotificationManager.java:4340)
	at android.app.NotificationManager.createNotificationChannels(NotificationManager.java:863)
	at android.app.NotificationManager.createNotificationChannel(NotificationManager.java:851)
	at com.uriio.beacons.BleService.updateForegroundNotification(BleService.java:424)
	at com.uriio.beacons.BleService.onAdvertiserStarted(BleService.java:378)
	at com.uriio.beacons.ble.AdvertisersManager.onAdvertiserStarted(AdvertisersManager.java:113)
	at com.uriio.beacons.ble.Advertiser.onStartSuccess(Advertiser.java:102)
	at android.bluetooth.le.BluetoothLeAdvertiser$5.run(BluetoothLeAdvertiser.java:812)
	at android.os.Handler.handleCallback(Handler.java:938)
	at android.os.Handler.dispatchMessage(Handler.java:99)
	at android.os.Looper.loop(Looper.java:246)
	at android.app.ActivityThread.main(ActivityThread.java:8645)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:602)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1130)
Caused by: android.os.RemoteException: Remote stack trace:
	at com.android.server.notification.PreferencesHelper.createNotificationChannel(PreferencesHelper.java:995)
	at com.android.server.notification.NotificationManagerService$12.createNotificationChannelsImpl(NotificationManagerService.java:3978)
	at com.android.server.notification.NotificationManagerService$12.createNotificationChannels(NotificationManagerService.java:3999)
	at android.app.INotificationManager$Stub.onTransact(INotificationManager.java:1710)
	at android.os.Binder.execTransactInternal(Binder.java:1190

It seems the library is somehow looping and creating over 50000 channels, which cause the app to crash. Any ideas what causes this and if there is a way to fix it?

Application feezes when trying to transmit beacons

Hello, I have couple of issue using this library.
I have two different devices:

  • Samsung XCover 4S
  • Huawei Mate 20 lite

On Samsung occasionally when I try to transmit a beacon, nothing happens for a while and then I get ANR.
On Huawei when I try to transmit beacon, simply nothing happens every time, but I don't get ANR (seems like it fails to access BLE transmitter).

What can I do about it?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.