title: Android BLE Advertisement gives error codes 1, 10 and 14 and status as 18
body: <p>I am making an app for BLE advertisement but as soon as I press the start transmitting button I get the toast message <code>status</code> as 18 and when I check the logcat I see error codes <code>1, 10 and 14</code>.</p>
  <p>I have included all permissions in the <code>manifest.xml</code> file also.</p>
  <p>Here is the advertisement code:</p>
  <pre><code>public void onAdvertiseButtonPressed(View view){
          final Button advertiseButton=(Button)view;
  
          Log.i(TAG,&quot;Advertise mode:&quot;+advertiseMode);
          Log.i(TAG,&quot;Advertise power:&quot;+advertisePower);
  
  
          AdvertiseData advertiseData = new AdvertiseData.Builder()
                  .setIncludeDeviceName(true)
                  .build();
          BluetoothLeAdvertiser bluetoothLeAdvertiser=BluetoothAdapter.getDefaultAdapter().getBluetoothLeAdvertiser();
  
  
  
              AdvertisingSetParameters parameters = new AdvertisingSetParameters.Builder()
                      .setInterval(advertiseInterval)
                      .setTxPowerLevel(advertisePower)
                      .setScannable(true)
                      .setConnectable(false)
                      .build();
  
  
              AdvertisingSetCallback advertisingSetCallback = new AdvertisingSetCallback() {
  
                  @Override
                  public void onAdvertisingSetStarted(AdvertisingSet advertisingSet, int txPower, int status) {
                      super.onAdvertisingSetStarted(advertisingSet, txPower, status);
                      Log.i(TAG,&quot;Advertising set started:::&quot; + advertisingSet + &quot;,txPower:&quot;+txPower+&quot;,status:&quot;+status);
                      if(advertisingSet!=null) {
                          advertisingSet.enableAdvertising(true, 0, 0);
                          advertiseButton.setEnabled(false);
                      }
                      else{
                          Toast.makeText(TransmitActivity.this, &quot;Start adv error status:&quot;+status, Toast.LENGTH_SHORT).show();
                      }
                  }
  
                  @Override
                  public void onAdvertisingSetStopped(AdvertisingSet advertisingSet) {
                      super.onAdvertisingSetStopped(advertisingSet);
                      Log.i(TAG,&quot;Advertising set stopped&quot;);
                      activeAdvertiseCallback = null;
                      handler.postDelayed(() -&gt; {
                          advertiseButton.setEnabled(true);
                          if(!isStopped)
                              onAdvertiseButtonPressed(advertiseButton);
                      }, 1);
  
                  }
  
                  @Override
                  public void onAdvertisingEnabled(AdvertisingSet advertisingSet, boolean enable, int status) {
                      super.onAdvertisingEnabled(advertisingSet, enable, status);
                      Log.i(TAG,&quot;Advertising set enabled:&quot;+enable + &quot;status:&quot; + status);
                      if(enable){
                          activeAdvertiseCallback = this;
                          handler.postDelayed(()-&gt; {
                              bluetoothLeAdvertiser.stopAdvertisingSet(this);
                          },1);
                      }
                  }
              };
              if (bluetoothLeAdvertiser == null) {
                  Log.e(TAG, &quot;Advertiser not found, isBluetoothOn &quot; + BluetoothAdapter.getDefaultAdapter().isEnabled());
                  Toast.makeText(this, &quot;Advertiser not found, isBluetoothOn &quot; + BluetoothAdapter.getDefaultAdapter().isEnabled(), Toast.LENGTH_SHORT).show();
              } else {
                  time = System.currentTimeMillis ();
                  bluetoothLeAdvertiser.startAdvertisingSet(parameters, advertiseData, null, null, null, advertisingSetCallback);
  
  
              }
  
      }
  </code></pre>
  <p>Logcat:</p>
  <pre><code>2020-06-28 23:16:09.471 11505-11505/com.example.bleexperiments E/CheckPermission: _bluetooth code = 1 
  2020-06-28 23:16:10.736 11505-11505/com.example.bleexperiments E/ColorViewRootUtil: nav gesture mode swipeFromBottom ignore false downY 951 mScreenHeight 2340 mScreenWidth 1080 mStatusBarHeight 54 globalScale 1.125 nav mode 3 event MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=114.0, y[0]=951.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=330086863, downTime=330086863, deviceId=6, source=0x1002, displayId=0 } rotation 0
  2020-06-28 23:16:14.980 11505-11505/com.example.bleexperiments E/ColorViewRootUtil: nav gesture mode swipeFromBottom ignore false downY 1389 mScreenHeight 2340 mScreenWidth 1080 mStatusBarHeight 54 globalScale 1.125 nav mode 3 event MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=763.0, y[0]=1389.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=330091106, downTime=330091106, deviceId=6, source=0x1002, displayId=0 } rotation 0
  2020-06-28 23:16:15.097 11505-11505/com.example.bleexperiments E/CheckPermission: _bluetooth code = 14 
  2020-06-28 23:16:15.099 11505-11505/com.example.bleexperiments E/CheckPermission: _bluetooth code = 14 
  2020-06-28 23:16:15.102 11505-11505/com.example.bleexperiments E/CheckPermission: _bluetooth code = 10 
  2020-06-28 23:18:06.785 11505-11505/com.example.bleexperiments E/ColorViewRootUtil: nav gesture mode swipeFromBottom ignore false downY 1414 mScreenHeight 2340 mScreenWidth 1080 mStatusBarHeight 54 globalScale 1.125 nav mode 3 event MotionEvent { action=ACTION_DOWN, actionButton=0, id[0]=0, x[0]=837.0, y[0]=1414.0, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=330202905, downTime=330202905, deviceId=6, source=0x1002, displayId=0 } rotation 0
  2020-06-28 23:18:06.872 11505-11505/com.example.bleexperiments E/CheckPermission: _bluetooth code = 14 
  2020-06-28 23:18:06.874 11505-11505/com.example.bleexperiments E/CheckPermission: _bluetooth code = 14 
  2020-06-28 23:18:06.878 11505-11505/com.example.bleexperiments E/CheckPermission: _bluetooth code = 10 
  </code></pre>