Bluetooth failed in sending

Bluetooth not sending file to other device

It is already asked but i didn’t find any solution. For bluetooth application i am using the bluetoothShare.class . My source code for sending the file to the target device MainActvity.class:

Set devices = btAdapter .getBondedDevices(); final String btDeviceName = selected_deviceName; BluetoothDevice device = null; for (BluetoothDevice itDevice : devices) < if (btDeviceName.equals(itDevice.getName())) < device = itDevice; >> if (device != null) < ContentValues values = new ContentValues(); values.put(BluetoothShare.URI, uri.toString()); values.put(BluetoothShare.MIMETYPE, "image/jpeg"); values.put(BluetoothShare.DESTINATION, device.getAddress()); values.put(BluetoothShare.DIRECTION, BluetoothShare.DIRECTION_OUTBOUND); Long ts = System.currentTimeMillis(); values.put(BluetoothShare.TIMESTAMP, ts); final Uri contentUri = getApplicationContext() .getContentResolver().insert( BluetoothShare.CONTENT_URI, values); Log.v(TAG, "Insert contentUri: " + contentUri + " to device: " + device.getName()); Toast.makeText(getApplicationContext(), "Success", Toast.LENGTH_LONG).show(); >else < textStatus .setText("Bluetooth remote device not found"); >> else < textStatus.setText("Bluetooth not activated"); >> else
package process.bluetooth.sendfile.opp; import android.net.Uri; import android.provider.BaseColumns; public final class BluetoothShare implements BaseColumns < private BluetoothShare() < >public static final String PERMISSION_ACCESS = "android.permission.ACCESS_BLUETOOTH_SHARE"; public static final Uri CONTENT_URI = Uri .parse("content://com.android.bluetooth.opp/btopp"); public static final String TRANSFER_COMPLETED_ACTION = "android.btopp.intent.action.TRANSFER_COMPLETE"; public static final String INCOMING_FILE_CONFIRMATION_REQUEST_ACTION = "android.btopp.intent.action.INCOMING_FILE_NOTIFICATION"; public static final String USER_CONFIRMATION_TIMEOUT_ACTION = "android.btopp.intent.action.USER_CONFIRMATION_TIMEOUT"; public static final String URI = "uri"; public static final String FILENAME_HINT = "hint"; public static final String _DATA = "_data"; public static final String MIMETYPE = "mimetype"; public static final String DIRECTION = "direction"; public static final String DESTINATION = "destination"; public static final String VISIBILITY = "visibility"; public static final String USER_CONFIRMATION = "confirm"; public static final String STATUS = "status"; public static final String TOTAL_BYTES = "total_bytes"; public static final String CURRENT_BYTES = "current_bytes"; public static final String TIMESTAMP = "timestamp"; public static final int DIRECTION_OUTBOUND = 0; public static final int DIRECTION_INBOUND = 1; public static final int USER_CONFIRMATION_PENDING = 0; public static final int USER_CONFIRMATION_CONFIRMED = 1; public static final int USER_CONFIRMATION_AUTO_CONFIRMED = 2; public static final int USER_CONFIRMATION_DENIED = 3; public static final int USER_CONFIRMATION_TIMEOUT = 4; public static final int VISIBILITY_VISIBLE = 0; public static final int VISIBILITY_HIDDEN = 1; public static boolean isStatusInformational(int status) < return (status >= 100 && status < 200); >public static boolean isStatusSuspended(int status) < return (status == STATUS_PENDING); >public static boolean isStatusSuccess(int status) < return (status >= 200 && status < 300); >public static boolean isStatusError(int status) < return (status >= 400 && status < 600); >public static boolean isStatusClientError(int status) < return (status >= 400 && status < 500); >public static boolean isStatusServerError(int status) < return (status >= 500 && status < 600); >public static boolean isStatusCompleted(int status) < return (status >= 200 && status < 300) || (status >= 400 && status < 600); >public static final int STATUS_PENDING = 190; public static final int STATUS_RUNNING = 192; public static final int STATUS_SUCCESS = 200; public static final int STATUS_BAD_REQUEST = 400; public static final int STATUS_FORBIDDEN = 403; public static final int STATUS_NOT_ACCEPTABLE = 406; public static final int STATUS_LENGTH_REQUIRED = 411; public static final int STATUS_PRECONDITION_FAILED = 412; public static final int STATUS_CANCELED = 490; public static final int STATUS_UNKNOWN_ERROR = 491; public static final int STATUS_FILE_ERROR = 492; public static final int STATUS_ERROR_NO_SDCARD = 493; public static final int STATUS_ERROR_SDCARD_FULL = 494; public static final int STATUS_UNHANDLED_OBEX_CODE = 495; public static final int STATUS_OBEX_DATA_ERROR = 496; public static final int STATUS_CONNECTION_ERROR = 497; > 

Источник

Читайте также:  Сколько заряжать кейс блютуз наушников

Что делать, если не передаются файлы через Bluetooth на Android

В этой статье мы поговорим о том, как следует поступить, если на вашем Андроид устройстве не работает передача посредством Bluetooth. Также мы подробно расскажем об основных причинах проблемы, из-за которых возникают ошибки при передаче файлов на другоt Андроид устройство.

Способ отправки

В самом начала давайте узнаем, как нужно отправлять информацию, чтобы на все 100% убедиться, что все ваши манипуляции до этого, были верными и основная проблема заключается в системе. Для этого нужно сделать следующие действия:

    Зайдите в раздел настроек Андроид устройства.

Настройки на Андроид

Bluetooth на Андроид

Активация Bluetooth на Андроид

Выбор файла для передачи по Bluetooth на Андроид

Выбор способа передачи на Андроид

Выбор Bluetooth для передачи файла на Андроид

Активация видимости Bluetooth на Андроид

Поиск Bluetooth устройств на Андроид

Выбор Bluetooth устройства для передачи на Андроид

Причины неполадок

Если вы делали так, как было описано в прошлом примере, но на каком-то шаге возникли проблемы, то давайте подробно разберем основные причины, по которым могла произойти ошибка в передаче. В большинстве вариантов эти ошибки возникают из-за особенностей, которые имеются у разработчиков разных устройств.

Доверенные устройства

При передаче информации на некоторые мобильные аппараты, с которыми до этого момент не проводился процесс обмена, без предварительного сопряжения устройств, информация может не приниматься. Попробуйте в самом начале просто подключиться к другому смартфону.

Для этого нужно выполнить следующие действия:

  1. Повторите пункты 1, 2 и 3 из вышеописанного примера.
  2. Тапните на кнопку «Поиск устройств» и ждите, пока имя второго смартфона высветится у вас в списке.

Поиск Bluetooth устройств на Андроид

Ввод ключа доступа Bluetooth для сопряжения Андроид устройств

Баги в прошивке

Сам Bluetooth модуль не имеет каких-либо определенных настроек. Если после применения вышеописанных способов у вас не получилось осуществить передачу данных, то нужно попробовать сделать перезагрузку системы. При перезапуске в системе автоматически исправляются мелкие ошибки, и имеется шанс того, что ваша проблема исчезнет.

Если рестарт системы ничего не поменял, рекомендуем сбросить настройки до заводского состояния: если на этой версии системы раньше удавалось осуществлять передачу данных, то почти со 100% шансом можно утверждать, что после сброса эта опция будет работать исправно. Если и после этого нет видимых изменений, то проблема состоит в беспроводном модуле, и единственным выходом будет поход в сервисный центр.

Чтобы сбросить настройки до заводских, потребуется:

  1. Зайти в меню настроек.
  2. Найти раздел с названием «Резервная копия и сброс».

Источник

Cannot send or receive a file via Bluetooth in Windows 11/10

Windows 11/10 OS has its own share of problems but fortunately, most of them can be fixed without seeking help from an expert. For example, the built-in tools in Windows 11/10 allow a user to send or receive files wirelessly via a Bluetooth connection. However, sometimes an issue can occur, and you may not be able to send or receive a file via Bluetooth. You may see a Waiting for connection message or Bluetooth file transfer not completed, File transfer is disabled by policy message.

Bluetooth Transfer not working

Bluetooth file transfer not completed, File transfer is disabled by policy

Cannot send or receive a file via Bluetooth in Windows 11/10

  1. Use Bluetooth Troubleshooter
  2. Enable file sharing for devices that use encryption
  3. Reinstall Bluetooth Adapter.

Find the detailed description below.

1] Use Bluetooth Troubleshooter

Bluetooth Problem Fixed

  1. Go to Windows Settings.
  2. In its Search bar type troubleshoot to select troubleshoot settings.
  3. Click the Additional Troubleshooters link.
  4. Go to the Find and fix other problems heading, choose Bluetooth (find and fix the problem with Bluetooth devices).
  5. Hit the Run the troubleshooter button.

The Bluetooth Troubleshooter will begin scanning for the issues and fix them successfully.

2] Enable file sharing for devices that use encryption

All Networks

  1. Open Control Panel.
  2. Go to Network & Sharing Center.
  3. Click on Change advanced Sharing Settings link.
  4. Click the All Networks drop-down menu. Scroll down to the File sharing connections heading.
  5. Check the option marked against Enable file sharing for devices that use 40 or 56-bit encryption.

Windows uses 128-bit encryption to help protect file-sharing connections. Some devices don’t support 128-bit encryption and must use 40 or 56-bit encryption.

When done, hit the Save changes button and exit. Try connecting the two devices again. You should now be able to send and receive files via the Bluetooth connection in Windows 10.

3] Reinstall Network adapter

  1. Open Device Manager from the WinX Menu
  2. Expand Bluetooth
  3. Select the Bluetooth adapter for your system
  4. Right-click on it
  5. select Uninstall
  6. Restart your PC
  7. Use the Scan for hardware changes option from the same menu.

Let Windows install the driver.

  1. Confirm that both the devices show as Paired. You can use Microsoft Swift Pair. It makes Bluetooth pairing quite simple.
  2. Also, when sending and receiving files, make sure that both your devices are awake and do not go to sleep.

Источник

How to Fix Bluetooth Transfer Not Working on Windows 10

Wireless file transfer is a convenient tool, which makes it all the more frustrating when you can’t transfer files over Bluetooth on Windows 10.

Computer Bluetooth Built In Featured

Readers like you help support MUO. When you make a purchase using links on our site, we may earn an affiliate commission. Read More.

If you need to share a single file from one device to another, sending it via Bluetooth is sometimes the fastest way. No need to search for a USB flash drive, add the file to an email, or upload it to a file transfer service—just pair your devices up and send the file over.

However, Bluetooth can be finicky, and sometimes it doesn’t do as you want it. If you’re having trouble receiving files via Bluetooth on your Windows 10 computer, here are several fixes that you can try.

1. Check if Bluetooth Is Turned On for Both Devices

The first step is to make sure Bluetooth is turned on for both of your devices. It may seem like a silly step, but sometimes Bluetooth can get disabled without you knowing or remembering.

For your Windows PC, open the Action Center and check if Bluetooth is turned on. If the Bluetooth tile is missing, go to Settings > Devices and check the toggle for Bluetooth. On the other device, double-check that its Bluetooth chip is enabled.

If you’ve turned it on for both devices but still can’t receive files, move on to the next solutions.

2. Remove Any Potential Bluetooth Interference

When sharing files through Bluetooth, try disconnecting other Bluetooth devices connected to your PC. For instance, if you are trying to share files with a computer that is connected to a Bluetooth wireless speaker, the two signals may clash and cause problems when sending files over.

Also, make sure the two devices are nearby and not obstructed by obstacles (such as walls or things made of metal) that could interfere with the Bluetooth connection.

Источник

Оцените статью
Adblock
detector