I am new to Unity and BLE, so I am having trouble getting Bluetooth connection. I tried following along the solution posted here: BLE device with Unity
But, I can't work it out. I have added the WclGattClientDll to my assets folder, but can't figure out how to connect to my Bluetooth device. My Bluetooth device uses the heart rate service and works properly, since it connects to the manufacturers phone app.
Thanks in advance for any help/suggestions.
This could be down to a permission problem. It is possible to solve this issue in both Unity (pre-build) and Visual Studio (post-build). Here are both solutions:
Solution A: in Unity
Head to Edit > Project Settings > Player.
In the Inspector, open up the tab Publishing Settings.
Under the Capabilities section, make sure that Bluetooth is enabled.
Click on the .gif to expand
Solution B: in Visual Studio (2017)
In your Solution Explorer (Ctrl+Alt+L), expand your project.
Double-click the Package.appxmanifest.
Go to the Capabilities tab.
Again, make sure that Bluetooth is enabled.
Click on the .gif to expand
This will give your app the right to use Bluetooth.
https://github.com/adabru/BleWinrtDll
For my project I created a UWP-BLE wrapper as C++-dll that you can copy into Unity. It works for the Unity-Editor and the Windows standalone version. It has only the basic functions but you can extend it with the rest of the UWP-API if you are willing to write some C++.
Related
I deploy my HoloLens 2 in Visual Studio through Release, ARM64, and Device. If I use the Release Machine instead of the Device, I got an error.
My desktop doesn't have the same Wi-Fi as my HoloLens. I can't connect my desktop and HoloLens to the same Wi-Fi.
My deploy is succeeded after I use the Device. My project Icon is shown in the HoloLens 2. But after I open the Icon, I can't see anything.
Please help me to find the solution. I spend a lot of time on this problem.
Maybe my explanation of Remote Machine and Device gave you some misunderstanding. I'm sorry about that. Remote Machine + WIFI and Device + USB are both officially recommended deployment methods. Since you have successfully deployed through Device, please continue to use it. If you are still a little confused about deployment you can publish a new thread.
It seems the main issue here is that when you run the deployed project, you cannot see any object. I recommend you try Remote Debugging(https://learn.microsoft.com/en-ca/windows/mixed-reality/develop/unity/preview-and-debug-your-app?tabs=openxr) in the Unity editor, which allows you to quickly preview and debug your project without deployment, and it can also be connected via USB. You can also use the official sample to Remote Debugging or deploy directly. Also, it's important to note that before you build your project in Unity, you need to add the scene to Build Settings->Scenes in Build.
Finally, I found the solution to my problem. Before I used the unity 2020.3.9. Now I changed the version to 2020.3.4. Now I can deploy and see the game objects in my hololens 2.
I had the same issue before. In the unity editor, I can see my models normally. But the models were not shown in Hololens, or only by one eye. The reason was that the models use the standard shader of Unity. After I applied the Mixed Reality Toolkit/ Standard Shaders, every model was shown.
I started a project on Unity and I would like to test it on an Android device, but I am unable to do so. I researched every tutorial out there and couldn't find a solution that worked for me. Note: I have been using Android Studio and I am able to launch apps both through an emulator and a USB phone.
I am pretty sure I correctly chose all the settings inside of Unity
(followed every single tutorial I could find).
Turned on developer mode on phone and tried multiple setting
variations that I could find on the web.
Made sure all the drivers are installed correctly (wouldn't be able
to do stuff through Android Studio if I haven't).
Uninstalled Unity and Unity Remote 5 multiple times.
JDK and NDK seem to be working fine. Tried turning adb server on and
off multiple times. Also I can see my device with the 'adb devices'
command.
I had some issues with MalwareBytes when installing Unity. I did try
granting permissions to every Unity folder I could find, but I think
MalwareBytes could be the culprit.
Has anyone encountered a similar issue? Is there another thing I could try? Any help is apreciated.
EDIT: I switched my VPN to a VPN that allows open source software and I also uninstalled Malwarebytes and replaced it with Avira. Did not fix the issue.
I did not run in exact same issue, but working with Unity remote might be a little tricky.
It may require to launch Unity remote first before launching Unity itself. And I hope did not forget to ProjectSettings -> Editor -> Any Android Device option to be set. I'm talking about Window OS.
I had the same issue today. I also did everything was mentioned in tutorials and nothing helped.
Then I noticed that when I press 'Play' there's a message in the console "Set-up Android SDK path to make Android remote work in Unity". After I went to 'Edit'->'Preferencies' I unchecked the 'Android SDK Tools Installed with Unity(recommended)', then closed Unity, opened it again and checked the box again.
It worked for me, I hope it will help you too :)
When you connect your phone to your PC, you may chose the file transfer option in your Android device, but charge mode worked for me, this is what I did:
1-Make sure that the "Any Android Device" option in Project Settings/Editor, is enabled and close unity.
2-Open the Unity remote app in the phone and connect it to the PC, in charge only mode.
3-Open Unity and run the game
This method worked for me, I hope it works for you too.
I am trying to publish a Xamarin.Forms app to Google Play but the Microsoft docs don't accurately reflect the current UI for Visual Studio. According to these docs, in order to publish to Google Play, you must first change the Channel from "Ad Hoc" to "Google Play". The docs say you do this by clicking the "back" button in the Distribute dialog.
Here's the problem: That button does not exist, at least not in the latest version of Visual Studio. I took a screenshot to illustrate:
As you can see, this does not match the screenshot in the Microsoft docs, which show a "Back" button that you're instructed to click on in order to navigate to the "Select Channel" dialog, which is where I need to go in order to make it a Google Play app. Simply clicking on "Select Channel" does absolutely nothing at all. Right-clicking anywhere only gives the option to delete and start over. I tried that and got the same result.
My app is a fairly simple Xamarin.Android C# app with package format set to "bundle" and Dex compiler set to "d8". Whether AOT/LLVM is enabled has no impact on this issue. Screenshots of full Android Options below:
What am I missing?? How do I get Visual Studio to play nice and let me select the correct channel?
Firstly even in the past to publish your App, you had to do it via Google Play Store website initally first anyway. You were able to push updates and new version after that. However, as far as I know (since I literally just published my first app 3 weeks ago), Visual Studio API that was responible for publishing the app is deprectated. You should get that error when you try to push it to Google Play. You can use the addhock option to sign the APK and push that APK directly via Google Play Console. Visual Studio doesnt support it anymore.
I have written a game using C# monogame android. I want to first transfer it to my personal phone and then upload it to google play possibly? How could i do that ? I saw that it is 25$ is this all the fee there is to it ? Can someone reference a blog to me, or guide me through, that would be helpful. All the information i found on google was kind of confusing.
#Shiro If you have APK file (Android Package executable file) then you can directly copy it on your phone and install it.
Which IDE are you using to develop. Intellij, Android Studio and Eclipse. Connect your phone to the system, enable the debugging in settings.
Click on the Run button, it loads the app to your phone.
You can also use the emulator (using AVD manager) in all the IDE mentioned above. Genymotion(an external emulator) can also be used
Go to your project "YourProject"\bin\Debug and copy yourprojct.apk file to your phone and install it.
For google play watch this tutorial.
I've found a few links but they don't explain how this is done. I can debug using Xamarin Studio IDE but that IDE (no offense) is lame compared to Visual Studio 2012.
Using Visual Studio 2012, there appears to only be option to select an emulator to debug. So how do I get it to debug on my real device via USB (I already have USB Debugging = true)?
I'm using Visual Studio 2017 with a OnePlus.
In order get debugging working I did the following.
Go to Settings > About phone and tap Build Number repeatedly until developer mode is enabled
Go into Settings > Developer options and turn USB debugging ON
Connect you phone to your PC via USB. I had to plug my phone into my PC's onboard USB port, not my USB hub as this did not work
You should be prompted to trust your PC (trust it)
Fire up Visual Studio
Open your solution and your device should now be available.
Side note: I have noticed that sometimes it also depends on the cable you use. If you still have no luck, perhaps try another cable.
You will get a confirmation prompt on the android device to ask if the PC is allowed to connect. It's easy to miss this if your device's screen has gone to sleep.
I'm using Visual Studio 2015 with Xamarin and the only way I can get it to recognize my Galaxy S4 is to turn USB debugging off and back on again while VS is running. This is required everytime I wish to use this phone with VS. I've never had to do this with Android Studio.
1 - Original drivers (Example: http://androidmtk.com/download-samsung-usb-drivers)
2 - Enable Developer's Options on mobile (for example on android 4.2.2, perform 7 click on "mobile info" - "serial number")
3 - USB debugging on your Mobile Developer's Options too
I also experienced a similar issue,
I solved it by installing the USB drivers specific to my phone model.
tl;dr Install drivers if you haven't already done so.
As mentioned in one of the comments above I installed the device specific USB driver (LG drivers are here) and it solved my problem. It now works perfectly.
I was under the (incorrect!) impression I wouldn't need to install the drivers to enable debugging. I could already connect my device to my laptop to view files etc. and hence thought drivers were unnecessary.
Once everything else is ready, the device could appear under the "Not compatible devices" list. This could be happening if the "Minimun Android version" set in your project is higher than android version you have in your device. If so, you can set the "Minimun Android version" in the android manifest
I set my Mobile connection in USB charging mode and enable USB debugging. It may ask for driver installation, after driver installation disconnect the mobile and reconnect it, now this should show in Visual studio device list for debugging.
It looks like Xamarin Android Player is not installed. You will need to install this.