Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/231.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android btAdapter.IsMultiConvertizementSupported()始终为false_Android_Altbeacon_Android Ibeacon - Fatal编程技术网

Android btAdapter.IsMultiConvertizementSupported()始终为false

Android btAdapter.IsMultiConvertizementSupported()始终为false,android,altbeacon,android-ibeacon,Android,Altbeacon,Android Ibeacon,我需要模仿灯塔。我使用设备 安卓6.0 LG,Nexus5 安卓9.0荣誉10 在我的应用程序/build.gradle中: implementation 'org.altbeacon:android-beacon-library:2.16.3' 在我的活动中: public void onClickGenerateBeacon(View view) { Beacon beacon = new Beacon.Builder() .setId1(U

我需要模仿灯塔。我使用设备

安卓6.0 LG,Nexus5 安卓9.0荣誉10 在我的应用程序/build.gradle中:

implementation 'org.altbeacon:android-beacon-library:2.16.3'
在我的活动中:

public void onClickGenerateBeacon(View view) {
        Beacon beacon = new Beacon.Builder()
                .setId1(UUID.randomUUID().toString())
                .setId2("1")
                .setId3("2")
                .setManufacturer(0x0118)
                .setTxPower(-59)
                .setDataFields(Arrays.asList(new Long[]{0l}))
                .build();
        BluetoothManager btManager = (BluetoothManager) getSystemService(BLUETOOTH_SERVICE);
        BluetoothAdapter btAdapter = btManager.getAdapter();
        boolean isSupported = false;
        if (btAdapter.isEnabled())
            isSupported = btAdapter.isMultipleAdvertisementSupported();

        if (isSupported) {
            BeaconParser beaconParser = new BeaconParser().setBeaconLayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25");
            BeaconTransmitter beaconTransmitter = new BeaconTransmitter(getApplicationContext(), beaconParser);
            beaconTransmitter.startAdvertising(beacon);
        }
    }
但isSupported总是错误的。因此,不执行:

new BeaconParser().setBeaconLayout("m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25");

我怎样才能解决这个问题?有没有可能通过这个lib来模拟信标,或者有其他方法?

不幸的是,这些手机上安装了Android操作系统,无法解决这个问题。如果IsMultipledEntertisementsSupported返回false,则操作系统本身会阻止传输可重复播放的广告。有关Nexus 5的说明,请参见

从理论上讲,你可以根你的Nexus5和安装一个不同的ROM映像,不阻止不可复制的广告。我从自己的经验中知道,Nexus5的Android L beta 1版本确实允许广告。该ROM图像不再可从谷歌获得,但您可能可以找到另一个安装在Nexus5上的ROM,它不会阻止此操作


至于华为荣誉设备,许多不支持广告,但有些支持。这里有一个稍微过时的,显示了已知的支持广告的设备。

要进行信标传输,我必须使用此表中的设备?Android emulator可以做到这一点吗?是的,您必须使用该表中的设备,尽管表中未提及的较新设备也可以工作。Android模拟器不模拟蓝牙,因此不能将其用作发射机。