GodotBluetooth icon indicating copy to clipboard operation
GodotBluetooth copied to clipboard

Compiling for 3.1.1

Open SigmaOrionis opened this issue 5 years ago • 16 comments

edit config.py:

def can_build(env, plat):
	return plat=="android"

def configure(env):
	if (env['platform'] == 'android'):
		env.android_add_to_permissions("android/AndroidPermissionsChunk.xml")
		env.android_add_java_dir("android/src")

edit GodotBluetooth.java: comment this line: //import android.support.v7.app.AppCompatActivity;

there is no engine.cfg in godot 3.1.1, add it to project.godot

tested with JDK 1.8.1_181 and godot 3.1.1

thank you for lib, favarete Kind regards

SigmaOrionis avatar Oct 24 '19 08:10 SigmaOrionis

hey , i have done all , with the same configurations but still couldn't figure out how to call the module.

func _ready():
    if(Engine.has_singleton("GodotBluetooth")):
        bluetooth = Engine.get_singleton("GodotBluetooth")
        bluetooth.init(get_instance_id(), false)
    print(Engine.has_singleton("GodotBluetooth"))

this does not work since has_singleton() returns false .

I also tried to go straight forward :

func _ready():
	bluetooth = GodotBluetooth.new()
	bluetooth.init(get_instance_id(), false)

but still it gives me a null erorr

I am sure i have done all right . Compiled with godot 3.1.1 - jdk 1.8.1 , configured the files, added module to project.godot properly , ran it on android , but i cannot call the bluetooth module .

Thanks SigmaOrionis Kind Regards

wigglybanana avatar Mar 23 '21 11:03 wigglybanana

Make sure that on host device all security levels are open for application. First that comes to mind. Regards. Sent from Mail for Windows 10 From: NewcaliburSent: 23. ožujka 2021. 12:01To: favarete/GodotBluetoothCc: SigmaOrionis; AuthorSubject: Re: [favarete/GodotBluetooth] Compiling for 3.1.1 (#7) hey , i have done all , with the same configurations but still couldn't figure out how to call the module.func _ready():    if(Engine.has_singleton("GodotBluetooth")):        bluetooth = Engine.get_singleton("GodotBluetooth")        bluetooth.init(get_instance_id(), false)    print(Engine.has_singleton("GodotBluetooth"))this does not work since has_singleton() returns false .I also tried to go straight forward :func _ready():        bluetooth = GodotBluetooth.new()        bluetooth.init(get_instance_id(), false)but still it gives me a null erorrI am sure i have done all right . Compiled with godot 3.1.1 - jdk 1.8.1 , configured the files, added module to project.godot properly , ran it on android , but i cannot call the blurtooth module .Thanks SigmaOrionisKind Regards—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe. 

SigmaOrionis avatar Mar 23 '21 13:03 SigmaOrionis

Make sure that on host device all security levels are open for application.

how can i assure this ?

wigglybanana avatar Mar 23 '21 17:03 wigglybanana

There must be some security settings which you use while compiling application for example android? Tomorrow I can look up how I did setup for android compilation. Sent from Mail for Windows 10 From: NewcaliburSent: 23. ožujka 2021. 18:13To: favarete/GodotBluetoothCc: SigmaOrionis; AuthorSubject: Re: [favarete/GodotBluetooth] Compiling for 3.1.1 (#7) Make sure that on host device all security levels are open for application. how can i assure this ?—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe. 

SigmaOrionis avatar Mar 23 '21 19:03 SigmaOrionis

Thanks , I got it working by enabling permissions on android export settings which are image

wigglybanana avatar Mar 23 '21 21:03 wigglybanana

Very good 😊 Sent from Mail for Windows 10 From: NewcaliburSent: 23. ožujka 2021. 22:05To: favarete/GodotBluetoothCc: SigmaOrionis; AuthorSubject: Re: [favarete/GodotBluetooth] Compiling for 3.1.1 (#7) Thanks , I got it working by enabling permissions on android export settings which are—You are receiving this because you authored the thread.Reply to this email directly, view it on GitHub, or unsubscribe. 

SigmaOrionis avatar Mar 24 '21 11:03 SigmaOrionis

Hi! I am trying to run the scons command, and it generates the following TypeError (in the config.py file): 'SConsEnvironment' object has no attribute 'android_add_to_permissions' I then edited the config.py exactly like what you have done above, but nothing has changed.

I am using Godot version 3.2.2 (since it has C# support for iOS which I will need for later). How can I compile this module for Godot version 3.2.2? (All other steps have been correctly performed, such as setting up the environment variables which works correctly as the Sconstruct file correct identified that Android is the targeted platform, but the error is generated at this module's config.py)

What should I do?

Thank you :)

fadikidess avatar Apr 11 '21 19:04 fadikidess

firstly, sorry to inform you that it is not compatible with younger builds since android structure has changed a lot in 3.2 . and make sure that you are using a valid ndk

wigglybanana avatar Apr 12 '21 09:04 wigglybanana

Thank you for your quick response!

So only the 3.1.1 version is supported, is that correct?

fadikidess avatar Apr 12 '21 09:04 fadikidess

Yes that is correct , i can provide you my builds if you want . It's sheered 8MB .

wigglybanana avatar Apr 12 '21 10:04 wigglybanana

That would be great! Thank you so much! Also does this library work with Bluetooth LE?

fadikidess avatar Apr 12 '21 11:04 fadikidess

Yes, i assume . Will provide them as soon as i reach to my rig.

wigglybanana avatar Apr 12 '21 16:04 wigglybanana

Yes, i assume . Will provide them as soon as i reach to my rig.

Thank you, but you don't need to do that, i just built them and will test them tomorrow, will let you know what happens! :D

Seriously thanks for your support, I really appreciate it!

fadikidess avatar Apr 12 '21 21:04 fadikidess

Ok so I got this error when attaching the script:

Parse Error: Method 'get_instance_ID' is not declared in the current class

What did I mess up now? 😂

fadikidess avatar Apr 13 '21 08:04 fadikidess

These code chunks were made in GODOT2 , you might expect those errors.

wigglybanana avatar Apr 13 '21 08:04 wigglybanana

So now I got the apk up and running, but nothing is happening, not even errors are being generated. (I'm not being asked to connect to anything, not even permissions are being asked). My project is using a native mobile ArVr singleton and it has two simple scripts (which is where something is likely to have gone):

This script is the edited global script (For my project I am not using the connected and disconnected signals, so I removed them, will that cause any issue?) ` signal data_received

var bluetooth

func _ready(): if(Engine.has_singleton("GodotBluetooth")): bluetooth = Engine.get_singleton("GodotBluetooth") bluetooth.init(.get_instance_ID(), true) if bluetooth: bluetooth.getPairedDevices(true) pass #GodotBluetooth Callbacks

func _on_data_received(data_received): emit_signal("data_received", data_received) pass`

This script is attached to the ArVr Camera

` extends ARVRCamera onready var global = get_node("/root/global") var speed var x var y var pressed

func _ready(): set_signals() pass func _on_data_received(data_received): var data = int(data_received) pressed = (data / 1000)%10 var r = (data / 100) % 10 var yx = data % 10 var xx = (data / 10) % 10 x = xx -4 y = yx - 4

pass

func _fixed_process(delta): translate(Vector3(0,delta *y,delta *x)) pass func set_signals(): global.connect("data_received", self, "_on_data_received") pass `

Although its not showing here, all indentations are correctly implemented

fadikidess avatar Apr 13 '21 10:04 fadikidess