I am getting an error once I load my app in Android Things on Rasperry PI, it shows a message about "Bluetooth has stopped".
This happens just after registering the GPS Driver. it does not affect the functionality and it is only at the first time.
It has already some permissions in the xml
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="com.google.android.things.permission.MANAGE_GNSS_DRIVERS" />
<uses-permission android:name="com.google.android.things.permission.USE_PERIPHERAL_IO" />
Looks like it requires to switch the port to GPS or unregister Bluetooth first... By the way I am not using bluetooth feature in the app. any idea?
thanks
if (context.checkSelfPermission(Manifest.permission.ACCESS_FINE_LOCATION)
!= PackageManager.PERMISSION_GRANTED) {
Log.e(TAG, "No permission");
return;
}
try {
// Register the GPS driver
mGpsDriver = new NmeaGpsDriver(context, "UART0", UART_BAUD, ACCURACY);
mGpsDriver.register();
This is a known limitation of the Raspberry Pi, as per the pinout documentation:
The Raspberry Pi has pins that are multiplexed between various board functions. Some board functions cannot be used simultaneously (for example, enabling Bluetooth and using the UART0 port for peripheral I/O).
So there may be a process running in the background which is still using Bluetooth and causing the driver to crash.
Related
Using D-bus am trying to automatically connect raspberry pi with mobile through Bluetooth, it works fine for 265 times but again when I try I get an error
I created a file /etc/dbus-1/session-local.conf and added
<!DOCTYPE busconfig PUBLIC "-//freedesktop//DTD D-Bus Bus Configuration 1.0//EN"
"http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd">
<busconfig>
<limit name="max_replies_per_connection">1200</limit>
</busconfig>
But still am getting the same error
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.LimitsExceeded: The maximum number of active connections for UID 1000 has been reached
devise doesnt exist
Can anyone let me know if there is anyway to change d-bus limits
Please help me out am new to it
This is the code I'm using to try to start Bluetooth discovery. However, I always end up with the "Unable to start discovery" message (see below the code).
Device: Pixel 3 running Android 10 API 29
from grade file:
minSdkVersion 16
targetSdkVersion 30
from manifest file:
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-feature android:name="android.hardware.bluetooth" />
from java:
if (bluetoothAdapter==null)
Log.i("BT", "First must enable BT");
else
{
if(bluetoothAdapter.getState()==bluetoothAdapter.STATE_ON)
{
Log.i("BT", "BT State on");
if (bluetoothAdapter.isDiscovering()) {
Log.i("BT", "was already discovering");
bluetoothAdapter.cancelDiscovery();
}
if(bluetoothAdapter.startDiscovery())
Log.i("BT", "starting discovery");
else
Log.i("BT", "Unable to start discovery");
}
else
Log.i("BT", "BT State NOT on");
}
Thanks!
So despite all permissions from the manifest, the app was declined Location servces by the system and my app wasn't even listed when I was going to the Location settings in the phone menu. I had to go to the drop down menu and enable "Show system" and then a bunch of other apps with weird names appeared, among them my app. I enabled "alwasys allow" and now BT is discovering nearby devices.
How can I request this permission at runtime then so I make sure I have permission without having to go to the Settings Menu?
Hy everybody,
I have a problem with Audio Manager on Huawei phones. I have an app, which can route the voice of calls to earpiece or loudspeaker from bluetooth headset during the call. It works fine on all of the phones except Huawei phones.
I added all permissons what is needed.
Anybody have similar situation?
<permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" android:protectionLevel="signature"/>
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.PROCESS_OUTGOING_CALLS" />
<uses-permission android:name="android.permission.PROCESS_INCOMING_CALLS" />
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
This part of code does not do anything on Huawei. A tried try/catch, but no exception comes.
private static void switch_to_earpiece () {
m_amAudioManager = (AudioManager) fa.getSystemService(fa.AUDIO_SERVICE);
m_amAudioManager.setMode(AudioManager.MODE_IN_CALL);
m_amAudioManager.stopBluetoothSco();
m_amAudioManager.setBluetoothScoOn(false);
m_amAudioManager.setSpeakerphoneOn(false);
}
I'm writing a Windows 10 UWP app on my Surface Pro 3 which is connected to my Microsoft Band 2 and I can connect to it just fine when I'm running the app in the foreground.
But now I'm trying to use the DeviceUseTrigger and run some logic in a background task. When I call the method to connect to the band:
var bandInfo = (await BandClientManager.Instance.GetPairedBandsAsync()).FirstOrDefault();
var bandClient = await BandClientManager.Instance.ConnectAsync(bandInfo);
I get the following error:
An error occurred while attempting to acquire the Bluetooth device
service. This error can occur if the paired device is unreachable or
has become unpaired from the current host.
I added the following capabilities to my UWP appxmanifest:
<DeviceCapability Name="bluetooth" />
<DeviceCapability Name="location" />
<DeviceCapability Name="proximity" />
<DeviceCapability Name="bluetooth.rfcomm">
<Device Id="any">
<Function Type="serviceId:A502CA9A-2BA5-413C-A4E0-13804E47B38F" />
<Function Type="serviceId:C742E1A2-6320-5ABC-9643-D206C677E580" />
</Device>
</DeviceCapability>
And this is my declaration of the background task:
<Extensions>
<Extension Category="windows.backgroundTasks" EntryPoint="WindowsRuntimeComponent1.BandBackgroundTask">
<BackgroundTasks>
<Task Type="deviceUse" />
</BackgroundTasks>
</Extension>
</Extensions>
Just a guess, but does this paragraph from the Band SDK documentation possibly help with your call of GetPairedBandsAsync as well?
If your app wants to connect to the Band from the background, then the
app should call GetBandsAsync(isBackground: true) to get a connection
that will not interfere with any app that is running in the foreground
and currently using a Band connection.
I have page where I am allowing myusers to listen music online everything works just fine in pc but when I try to check in nokia symbian, blackberry Android nothing plays
I am using flash MP3 player and my simple codes are here.
I am interested in playing in all mobiles as my main target is mobile users so any idea how can I play them all even in old nokia symbian mobiles will be a great help
All mobiles are supporting JavaScript as I can browse complicated websites with nokia blackberry and Android but only issue is MP3. Any suggestion to play in all mobile phone is welcome.
My live site http://way2enjoy.com/rstadmin/listenmusicmobile/1528\
My code
<object type="application/x-shockwave-flash" name="audioplayer_1" style="outline: none" data="http://way2enjoy.com/js/player/player.swf" width="500" height="24" id="audioplayer_1"><param name="wmode" value="opaque"><param name="menu" value="false"><param name="flashvars" value="soundFile=uploads/userfiles/201206/1120_56_584iq.preview.mp3&titles=Hanuman Chalisa by Gulshan Kumar&artists=claim_your_money&autostart=yes&loop=yes&playerID=audioplayer_1"></object><script type="text/javascript" src="http://way2enjoy.com/js/player/audio-player.js"></script><script type="text/javascript">
$(document).ready(function(){
AudioPlayer.setup("http://way2enjoy.com/js/player/player.swf", {
width: 500
});
AudioPlayer.embed("audioplayer_1", {
soundFile: "http://way2enjoy.com/uploads/userfiles/201206/1120_56_584iq.preview.mp3",
titles: "Hanuman Chalisa by Gulshan Kumar",
artists: "claim_your_money",
autostart: "yes",
loop: "yes"
});
});
</script>
I am interested in playing in mobile only but I want all mobiles including older nokia symbian etc.
Newest Android phones don't have Flash support anymore...
Also the Flash player needs to support mp3 (I don't know if that is default)
You should try different solutions for different phones. You can do this by checking if the object is support (as last resort the User Agent string).