Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
  • Help Room /
avatar image
0
Question by KUBODeveloper · Aug 11, 2017 at 06:49 AM · iosassetandroidpluginnative pluginbluetooth

How to turn on Bluetooth from inside Unity?

Hi,

I am looking for a way to turn on Bluetooth on Android and iOS devices from inside my unity application or to trigger a prompt to ask the user for this (like in the example img).

Does anyone know of an asset, that can help me with this or if Unity has this feature already?

alt text

Help will be greatly appreciated!

Kind regards, Rasmus Lindholm

2017-08-03-145020.png (275.6 kB)
Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image healthplexus · Apr 06, 2018 at 03:01 AM 0
Share

@$$anonymous$$uboRobot This is a very good BLE plugin, that will give an error if Bluetooth is disabled, so you can ask user to turn it on and this is the way it should be done for the app stores to accept the app. We use the automatic way for the internal testing only: Bluetooth LE for iOS, tvOS and Android

3 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by · Feb 14, 2018 at 03:18 PM

public void setBluetoothEnabled() { using (AndroidJavaObject activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic ("currentActivity")) { try { using (var BluetoothManager = activity.Call ("getSystemService", "bluetooth")) { using (var BluetoothAdapter = BluetoothManager.Call ("getAdapter")) { BluetoothAdapter.Call("enable"); } } } catch (Exception e) { } } } @KuboRobot This will silently turn on bluetooth, without pop-ups because you grant permissions while installing an app, also, you have to add this to your AndroidManifest.xml: uses-permission android:name="android.permission.BLUETOOTH_ADMIN" uses-permission android:name="android.permission.BLUETOOTH" (probably not needed)
Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image KUBODeveloper · Feb 15, 2018 at 10:05 AM 0
Share

Thank you very much! Is there something similar to do this on iOS devices?

avatar image KUBODeveloper · Feb 15, 2018 at 01:12 PM 0
Share

Its certainly possible but complicated, for IOS you will probably need to write plugin in C, this and this link might be helpful, there are some of them on Asset Store e.g. BTLE

avatar image zyonneo · Aug 09, 2018 at 06:19 AM 0
Share

@$$anonymous$$ Hi Is it possible to connect to BLE devices(Beacons) and receive data from that using Unity.I do not know android studio or swift to make plugins.I am looking to make an indoor navigation app by detecting beacons using Unity..Any help will be appreciated.

avatar image healthplexus zyonneo · Aug 09, 2018 at 12:19 PM 0
Share
@zyonneo Yes, and the answer is in this thread few posts above: This is a very good BLE plugin, that will give an error if Bluetooth is disabled, so you can ask user to turn it on and this is the way it should be done for the app stores to accept the app. We use the automatic way for the internal testing only: [Bluetooth LE for iOS, tvOS and Android][1] Also nRF Connect app is very helpful for discovering all IDs and characteristics of BLE devices. [1]: https://assetstore.unity.com/packages/tools/network/bluetooth-le-for-ios-tvos-and-android-26661
avatar image zyonneo healthplexus · Aug 09, 2018 at 12:55 PM 0
Share
@healthplexus The above answer is just a setBluetoothEnabled() function.I believe it is to turn on bluetooth device when we call that.How to get values from Beacon? Without Plugins is it possible?Else how to use plugins?How to connect it to a BLE devie and retrieve broadcasting messages?
Show more comments
avatar image
1

Answer by healthplexus · Apr 06, 2018 at 02:46 AM

@adammak23 Worked for us in Unity 2017.3.0f3 after this small change, thanks:` BluetoothAdapter.Call <bool>("enable");`
Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by jimmoriarty101010 · Jun 27, 2018 at 09:49 AM

This is the fastest way to turn ON/OFF bluetooth in android. https://windowsclassroom.com/how-to-turn-on-bluetooth-on-windows-10/ you can follow it if you want to know how to turn ON bluetooth on windows 10.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

136 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

IOS Phone Gallery Open 0 Answers

Why do the Prepare OS for Recording option and OpenMic Disable bluetooth audio playback. 1 Answer

How to get the low level rendering plugin working on Android? 1 Answer

How to use android-bluetooth plugin in unity? 0 Answers

Using .framework for iOS as Plugin. 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges