org.altbeacon.beacon.utils.UrlBeaconUrlCompressor Java Examples

The following examples show how to use org.altbeacon.beacon.utils.UrlBeaconUrlCompressor. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GattBeaconTest.java    From android-beacon-library with Apache License 2.0 6 votes vote down vote up
@Test
public void testDetectsUriBeacon() {
    org.robolectric.shadows.ShadowLog.stream = System.err;
    LogManager.setLogger(Loggers.verboseLogger());
    LogManager.setVerboseLoggingEnabled(true);
    //"https://goo.gl/hqBXE1"
    byte[] bytes = {2, 1, 4, 3, 3, (byte) 216, (byte) 254, 19, 22, (byte) 216, (byte) 254, 0, (byte) 242, 3, 103, 111, 111, 46, 103, 108, 47, 104, 113, 66, 88, 69, 49, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    BeaconParser parser = new BeaconParser().setBeaconLayout("s:0-1=fed8,m:2-2=00,p:3-3:-41,i:4-21v");
    LogManager.d("xxx", "------");
    Beacon uriBeacon = parser.fromScanData(bytes, -55, null, 123456L);
    assertNotNull("UriBeacon should be not null if parsed successfully", uriBeacon);
    assertEquals("UriBeacon identifier length should be correct",
            14,
            uriBeacon.getId1().toByteArray().length);
    String urlString = UrlBeaconUrlCompressor.uncompress(uriBeacon.getId1().toByteArray());
    assertEquals("URL should be decompressed successfully", "https://goo.gl/hqBXE1", urlString);
}
 
Example #2
Source File: DetectedBeacon.java    From beaconloc with Apache License 2.0 4 votes vote down vote up
@Override
public String getEddystoneURL() {
    return UrlBeaconUrlCompressor.uncompress(getId1().toByteArray());
}