List of usage examples for android.bluetooth.le AdvertiseCallback ADVERTISE_FAILED_TOO_MANY_ADVERTISERS
int ADVERTISE_FAILED_TOO_MANY_ADVERTISERS
To view the source code for android.bluetooth.le AdvertiseCallback ADVERTISE_FAILED_TOO_MANY_ADVERTISERS.
Click Source Link
From source file:com.android.bleserver.AdvertiserFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); advertisingFailureReceiver = new BroadcastReceiver() { /**//w w w .java2s. c o m * Receives Advertising error codes from {@code AdvertiserService} and displays error messages * to the user. Sets the advertising toggle to 'false.' */ @Override public void onReceive(Context context, Intent intent) { int errorCode = intent.getIntExtra(AdvertiserService.ADVERTISING_FAILED_EXTRA_CODE, -1); mSwitch.setChecked(false); String errorMessage = getString(R.string.start_error_prefix); switch (errorCode) { case AdvertiseCallback.ADVERTISE_FAILED_ALREADY_STARTED: errorMessage += " " + getString(R.string.start_error_already_started); break; case AdvertiseCallback.ADVERTISE_FAILED_DATA_TOO_LARGE: errorMessage += " " + getString(R.string.start_error_too_large); break; case AdvertiseCallback.ADVERTISE_FAILED_FEATURE_UNSUPPORTED: errorMessage += " " + getString(R.string.start_error_unsupported); break; case AdvertiseCallback.ADVERTISE_FAILED_INTERNAL_ERROR: errorMessage += " " + getString(R.string.start_error_internal); break; case AdvertiseCallback.ADVERTISE_FAILED_TOO_MANY_ADVERTISERS: errorMessage += " " + getString(R.string.start_error_too_many); break; case AdvertiserService.ADVERTISING_TIMED_OUT: errorMessage = " " + getString(R.string.advertising_timedout); break; default: errorMessage += " " + getString(R.string.start_error_unknown); } Toast.makeText(getActivity(), errorMessage, Toast.LENGTH_LONG).show(); } }; }
From source file:sample.hawk.com.mybasicappcomponents.hardware.bt_advertisements.BLE_AdvertiserFragment.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); advertisingFailureReceiver = new BroadcastReceiver() { /**//from www.ja va 2 s . c o m * Receives Advertising error codes from {@code AdvertiserService} and displays error messages * to the user. Sets the advertising toggle to 'false.' */ @Override public void onReceive(Context context, Intent intent) { int errorCode = intent.getIntExtra(BLE_AdvertiserService.ADVERTISING_FAILED_EXTRA_CODE, -1); mSwitch.setChecked(false); String errorMessage = getString(R.string.start_error_prefix); switch (errorCode) { case AdvertiseCallback.ADVERTISE_FAILED_ALREADY_STARTED: errorMessage += " " + getString(R.string.start_error_already_started); break; case AdvertiseCallback.ADVERTISE_FAILED_DATA_TOO_LARGE: errorMessage += " " + getString(R.string.start_error_too_large); break; case AdvertiseCallback.ADVERTISE_FAILED_FEATURE_UNSUPPORTED: errorMessage += " " + getString(R.string.start_error_unsupported); break; case AdvertiseCallback.ADVERTISE_FAILED_INTERNAL_ERROR: errorMessage += " " + getString(R.string.start_error_internal); break; case AdvertiseCallback.ADVERTISE_FAILED_TOO_MANY_ADVERTISERS: errorMessage += " " + getString(R.string.start_error_too_many); break; case BLE_AdvertiserService.ADVERTISING_TIMED_OUT: errorMessage = " " + getString(R.string.advertising_timedout); break; default: errorMessage += " " + getString(R.string.start_error_unknown); } Toast.makeText(getActivity(), errorMessage, Toast.LENGTH_LONG).show(); } }; }