Spotify get song name - MTCD Android Head Units General

Hi, I'm making a custom interface for my HU Erisin ES8846B, and I'm trying to get the current song playing from the app. The HU is not connected to the internet so i cannot use the Android SDK, since it needs an internet connection. Basically I make a BroadcastReciever and listen for this message : "com.spotify.music.playbackstatechanged". I tried it on a Lenovo P1 Vibe, and a Samsung Galaxy 8 and the Spotify app does broadcast this message. But when I try it on my unit the text field stays empty. Any advice on how to bypass this problem ?
Code:
IntentFilter iF = new IntentFilter();
iF.addAction("com.spotify.music.playbackstatechanged");
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
String artistName = intent.getStringExtra("artist");
String trackName = intent.getStringExtra("track");
//do something with information
}

Related

Problem with opening COM port in XDA

Hi,
I use MS eMbedded Visual C++ for create my applications.
I create aplications for iPaq and XDA.
I can't open communication port COM in XDA.
I use follow function:
lpszPortName = TEXT("COM1:"); // COM port = COM1
// open COM port
if (hPort == INVALID_HANDLE_VALUE)
{
hPort = CreateFile (lpszPortName, GENERIC_READ | GENERIC_WRITE,
0, NULL, OPEN_EXISTING,
0,
NULL);
}
Handle hPort has got enduringly value INVALID_HANDLE_VALUE.
If I use this function in iPaq so it execute all OK.
I've got close all aplications, witch work with COM port.
I use synchronization cable for transfer data from external equipment in XDA.
Where is my mistake? Please, help mi.
[email protected]
not sure if yu just cut/pasted your code incorrectly, but you should test if the handle is valid -after- you open it, not before.
specify
Next example is only cut my source code. I make test so after open COM port.
I use function GetLastError for get more information.
GetLastError return this result:
code 55:
text: The specified network resource or device is no longer available.
Where is problem?
If I use this cable for synchronization between XDA and my PC, all is OK.
What COM port is use during this connection?
[email protected]
I have also had this error code 55 problem. It means that the comm port is already open by something else. This should happen if the XDA was already sat in a serial cradle with ActiveSync running, BUT I have had it repeatadly happen for no reason.
Do Settings -> Connections -> Beam and UnTick 'Receive incoming beams'. I don't know why this causes the problem but it seems to clear it. Please tell me reason why this works.
Another 'cure' I have found is that if you use ActiveSync and serially sync the XDA, then remove it from the cradle. Then your code will work, but possibly only once.
When it does work - transmit a stream of characters (say a file about 500 bytes) out of the comm1 port, then it will work correctly and can be open/closed as expected.
Let me know how you get on, I would like to know a reason why this problem happens.
Cheers
Paul

Touch Pro 2 - Bluetooth Compatability

I have a compatability problem between my new HTC Touch Pro 2 and my new Volvo XC 60 as detailed below. HTC say the following
The Bluetooth stack refers to the suite of protocols that are compiled to provide Bluetooth functionality. At this time, there is currently no official software available that will correct this issue. It may be possible for you to obtain third-party software
Is there anyone who may know if such a Third Party Software provider who can resolve this, many thanks
Regards
Symptoms of failure of the Bluetooth set up
Does dial out but doesn’t ring inside the phone
Does connect to other end but no voice can be heard at either end
Does download the phonebook
Background
Phone shipped as HTC Touch Pro 2 with Windows Mobile 6.5 – ROM 1.86.401.0 (401 Designates English)
Car delivered as follows Volvo XC 60 – 04.22_R Bluetooth
Phone publicised on Volvo Cars web site as compatible
Firmware must be version ROM 1.19.413.2
Downgraded the phone to ROM 1.19.413.2, phone becomes Swedish + Windows Mobile 6.1
Downgrade the phone to ROM 1.19.401.1 phone becomes English + Windows Mobile 6.1
Without setting up the e-mail the phone becomes compatible with car Bluetooth for voice and phonebook
Setting up e-mail the phone returns to the original issue as per symptoms
Upgrade back to ROM 1.86.401.0 + Windows Mobile 6.5
Without setting up the e-mail the phone becomes compatible with car Bluetooth for voice, says that it downloads the phonebook, but no data is available from car side
Setting up e-mail the phone returns to the original issue as per symptoms
Yesterday upgrade car so that latest version of Bluetooth for Volvo is installed namely 04.23_R
Phone has ROM 1.86.401.0 + Windows Mobile 6.5 installed and email set up, upgrade fails to resolve problem
I hope that this makes sense, if please mail
There are several threads in this forum that provide some answers.
I have a new S80 - experienced the identical problem to yours - and I did the following registry changes:
BlueTooth Fix:
1.Navigate to HKLM\Security\Policies\Policies\
Click "Values" soft-key
Change "00001001" value to 1 (decimal) (recovery note: default is 2)
Change "00001005" value to 40 (decimal) (recovery note: default is 16)
Reboot device.
2. Modify the HandsFree plug-in:
HKLM\Software\WIDCOMM\Plugin\HandsFree
i. Change SupportedFeatures to 45 (default is 1135)
ii. Add value HFBDA binary, set to same value as LastConnectedBda
iii. Add value HFDeviceType decimal 2
3. Modify the WIDCOMM bluetooth general settings:
HKLM\Software\WIDCOMM\BtConfig\General
i. Change bdaddr to (no value)
ii. Change DisableReopenAudio to 0 (default is 1)
4. Reboot device
To find other threads on this forum (and PPC Geeks) search for "Pairing bluetooth with car".
@prubin
you, sir are a genius! I went from having one of the worst wm bluetooth experiences to one of the best! thanks!
Phonebook
Look at this thread if you want the phonebook to work.
http://forum.xda-developers.com/showthread.php?t=591322&page=3
/MrFredd
Touch Pro 2 vs Pioneer Avic x9115bt
I couldn't answer incoming calls. This worked perfectly. Thank you
I have had quite similar problems with my HTC TP2 an a Volvo V50.
Then I found out that there was an update of the BT-software of the car. The Volvo-Service installed the free update of the software in the car. Now it works fine without any problems.

Problem with bluetooth audio with python

Hi everyone,
I have a problem with my Xperia Arc s, i want to develop a soft which transform my laptop in a Handsfree. I start to write a script in python and i can pass somme command to the phone in order to call someone, but when i want to store the data which i receive i got a problem. It seems that the phone doesn't send evry audio packet through the sco connection. When i want to play the audio data with audacity (16bits 8000Hz) some samples are missing and so the flow of audio is too speed. This is the script in python, i execute it on debian :
Code:
#!/usr/bin/python
import bluetooth
from bluetooth import *
from select import *
import os
import sys
import struct
import bluetooth._bluetooth as bt
import binascii
import time
fichier = open("testaudio2.cvsd", "w")
#bluetooth adres of the device
bt_addr = "90:C1:15:01:91:05" #tdr
channel = 10
#socket connection for bluetooth
sock = bluetooth.BluetoothSocket(bluetooth.RFCOMM)
sock.connect((bt_addr, channel))
print "connected"
#send of some command
sock.send('AT+BRSF=0\r')
data = sock.recv(1024)
print "BRSF"
print data
print "*********************"
sock.send('AT+CMER=3,0,0,1\r')
data = sock.recv(1024)
print "CMER"
print data
sock.send('AT+VGS=6\r')
data = sock.recv(1024)
print "VGS"
print data
sock.send('AT+VGM=5\r')
data = sock.recv(1024)
print "VGM"
print data
sock.send('AT+BAC=1\r')
data = sock.recv(1024)
print "BAC"
print data
#send call command
sock.send('ATD660;\r')
data = sock.recv(1024)
print "ATD"
print data
#Connexion SCO
#check voice settings. switch to S16 LE mono 8kHz CVSD if needed
hci_sock=bt.hci_open_dev()
response = bt.hci_send_req(hci_sock, bt.OGF_HOST_CTL,
bt.OCF_READ_VOICE_SETTING, bt.EVT_CMD_COMPLETE, 3, "")
status, voice_setting = struct.unpack("<BH", response)
if voice_setting != 0x60:
new_vs = struct.pack("<H", 0x60)
bt.hci_send_req(hci_sock, bt.OGF_HOST_CTL,
bt.OCF_WRITE_VOICE_SETTING, bt.EVT_CMD_COMPLETE, 1, new_vs)
#determine the maximum packet size
response = bt.hci_send_req(hci_sock, bt.OGF_INFO_PARAM,
bt.OCF_READ_BUFFER_SIZE, bt.EVT_CMD_COMPLETE, 8)
status, acl_mtu, sco_mtu, acl_nbufs, sco_nbufs = \
struct.unpack("<BHBHH", response)
raw_input("Press ENTER to continue")
sock2=BluetoothSocket(SCO)
sock2.connect((bt_addr,))
print sock2
# receive 1 second's worth of audio (data is 16-bit mono 8 kHz audio)
data = ""
while len(data) < 160000:
temp = sock2.recv(48)
data = data + temp
fichier.write(data)
sock2.close()
#send command to terminate call
sock.send('AT+CHUP\r')
data = sock.recv(1024)
print "CHUP"
print data
data = sock.recv(1024)
print "CIEV CHUP"
print data
sock.close()
This script is working for iphone, htc hd2, blackberry , galaxy s2 but not for my Arc S . I must record a ten second sample and i have a 17 second sample that make me thinking that the phone doesn't send all sco packet.
PLease help me ...
anyone have an idea ? sorry for my english , i you have any question and if the problem is not clear , ask me ...

[Q] How to hook into Bluetooth calls

Hi Everyone,
i have an app which is calling BluetoothAdapter.getDefaultAdapter().getAddress() but the application crashes.
Looking with logcat i see a NullPointerException after that call. I guess because the device does not have a bluetooth adapter and thus returning null.
Now, the question is: is it possible to intercept both calls which means getDefaultAdapter() and getAddress() in order so getAddress can return just a random mac string?
System info: android 6.0.1
Many thanks

Pair 3rd party BT remote even shield tv cannot search (root require)

Still in process, this may not work for every remote, especially those will lost pairing after reboot, and I found some remote will disconnect after a few hours and need pairing again, dunno this is bug of shield or anything else
Tested on Sheid TV 16gb 2017, firmware 5.01 (developer)
1. side load this app to your shield: "nRF Connect for Mobile", or any BLE scanner/connect app
2.a scan the remote and press connect
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
2.b when connected, shield tv will ask for pairing
2.c paired and connected but it still not work
3.a adb pull /data/misc/bluedroid
3.b you will see a list of paired device in bt_config.conf, include the 3rd party remote but it will lack most info
Code:
[XX:XX:XX:XX:XX:XX]
Name = 小米蓝牙遥控器
DevClass = 1344
DevType = 2
AddrType = 0
Timestamp = 1486758640
LE_KEY_PENC = a27d02fb2083ba5847f1e4734XXXXXXXXXXXXXXX
LE_KEY_PID = 1731754feb64c60edcd09XXXXXXXXXXXXXXXXXX
LE_KEY_PCSRK = 00000000db21e99ab6XXXXXXXXXXXXXXXXXX
LE_KEY_LENC = ef8ac21724e8fc31837XXXXXXXXXXXXXXXXXX
LE_KEY_LCSRK = 00000000842e019dd2caXXXXXXXXXXXXXXXXXXX
LE_KEY_LID =
Service = 00001812-0000-1000-8000-00805f9b34fb
HidReport = 4d2a0101222e4d2a020122324d2a030122364d2a0002223a4d2ae00322454d2ae10322484d2ae203224b4d2ae303224e4d2ae40322514d2ae50322544d2ae60322574d2ae703225a4d2ae803225d4d2ae90322604d2aea0322634d2aeb032266
HidAttrMask = 0
HidSubClass = 0
HidAppId = 255
HidVendorId = 10007
HidProductId = 12800
HidVersion = 273
HidCountryCode = 0
HidSSRMaxLatency = 0
HidSSRMinTimeout = 0
HidDescriptor = 05010906a1018502050719e029e71500250175019508810295017508810195057501050819012905910295017503910195067508152825fe0507192829fe8100c0
[XX:XX:XX:XX:XX:XX]
Name = 小米蓝牙遥控器
DevClass = 7936
DevType = 2
AddrType = 0
Timestamp = 1486758704
LE_KEY_PENC = fe426d85f40053734a9eXXXXXXXXXXXXXXXXXXXXXXXXX
LE_KEY_LID =
Service = 00001812-0000-1000-8000-00805f9b34fb
3.c
now fill in the miss part, mainly the "Service", and HID part which you can omit some of them, and never change those key nor add any missing key. For service most of them will be "00001812-0000-1000-8000-00805f9b34fb "
It is suggest to copy these info from another device, I copy them from my HTC 10
beware of the order of those line, wrong order may will refuse to work
suggest to use some text editor support unix format (LF for new line) such as pspad
4. after modify push back to shield tv, reboot (I didn't try if turning on/off bt will work or not)
5. refer to this post for key mapping https://forum.xda-developers.com/shield-tv/general/change-3rd-party-remote-key-layout-root-t3548871
for china version of xiaomi box bt remote, 1st version bt remote which use CR2032 will need repairing after reboot and also will disconnect after about 1 day, but it can pair by shield tv, it will say cannot pair for 1st try, just don't touch the remote and let shield pair it again, it will pair mostly in 2~3 try
2nd version of this bt remote without voice (just $4 usd) , which us 2xaaa battery can be pair using the above method, sheild tv cannot search for it, it will not disconnect after shield tv reboot/power off, I am still testing it, hope it will not disconnect after a few hours of using.
Tmall bt voice remote same as xiaomi 1st version bt remote, and the power button is IR, voice will not work
Edit
Sorry, rereading your post, i see were not discussing the same issue, my apologies
Edit2
Although you may have giving me some places i could look into, like the config file locations, reviewing them before pairing, after pairing, and after loss of pairing, so thanks for that
Im having this similar issue on marshmellow full android
Im having no problems with seing and pairing devices, but the shield forgets the pairing when i turn off, then turn on the bluetooth, making me have to repair again, which when you have so many devices to pair becomes a pain.
Ive not tested extensively, but the pairing seems to stick, at least in the first instance of turning bluetooth on and off, as long as the bluetooth device was connected when i turn off the bluetooth
I can test this a bit more, like pair more then one device(ive only been pairing/testing one device at a time), keep one device connected, turn off the bluetooth, and see if the shield remembers all the pairings, or just the one that was still connected, when i turned off the bluetooth
I do hope a solution becomes available, as i rely quite extensively on the shields bluetooth
Researching up on it, seems theres a little issue with marshmallow and bluetoth but not this exact problem, so im stumped, this post, and another on zulus marshmellow thread are the only places ive seen mention of this particular pairing problem, the forgetting your pairings issue
http://www.videomap.it/forum/viewto...d=01cc9900293e5b3a59e3dba77a43f876&start=1000
Lukecastle
'hi zulu,
I was wondering why everytime I turn on the shield from a shutdown. I'd always have to pair my bluetooth devices. For some reason it doesnt remember the already paired devices. Thanks'
Tried to signup to that site to add to lukecastles post, but it wont let me, im a spambot apparently
banderos101 said:
I was wondering why everytime I turn on the shield from a shutdown. I'd always have to pair my bluetooth devices. For some reason it doesnt remember the already paired devices. Thanks'
Tried to signup to that site to add to lukecastles post, but it wont let me, im a spambot apparently
Click to expand...
Click to collapse
Your problem actually the same as some of my bt device and I don't have a solution, it may be a mix of the bt device firmware problem and the Shield bt, every time it happen I saw a GATT disconnect then device refuse to connect again. What I know is some of my device is fixed after a firmware update(the bt device).
Edit:
Saw some similar bug on nexus, may be they are related, need time to keep digging
DummyPLUG said:
Your problem actually the same as some of my bt device and I don't have a solution, it may be a mix of the bt device firmware problem and the Shield bt, every time it happen I saw a GATT disconnect then device refuse to connect again. What I know is some of my device is fixed after a firmware update(the bt device).
Edit:
Saw some similar bug on nexus, may be they are related, need time to keep digging
Click to expand...
Click to collapse
Dont know if this will be any help in your search, but theres a floating/popup/overlay logcat on the playstore called 'logcat extreme' that might be usefull, maybe give you some clues you may understand better then me.
I tend to pause the log, clear it, then unpause right before an action, in this case
1. Turning on bluetooth(with nothing paired) (pause, then save log)
2. Clear log, unpause, pair device, pause, save log
3. Clear log, unpause, turn off bluetooth, pause, save log
4. Clear log, unpause, turn on bluetooth(testing the pairing), pause, save log
Ill probably go over this again more thoroughly if more information comes out that helps me look out for something specific, perhaps this "GATT disconnect " that you speak off
The fact that this issue is happening on the nexus, as you say, seems to indicate that this is an issue with android itself, so im hoping, once xposed comes out for nouget, that this issue will be resolved when i update, which will be fun, seing as my adb/fastboot is not working........hoping flashfire app will do the job in this case, aswell as, hopefully, fix the adb/fastboot, but i digress
Edit
I have a very strong feeling that im gonna turn my device into a door stop when i eventually test/hope/hail mary with flashfire, a new shield purchase may be in my future just hope their still selling the 2015 model when/if i do
banderos101 said:
Dont know if this will be any help in your search, but theres a floating/popup/overlay logcat on the playstore called 'logcat extreme' that might be usefull, maybe give you some clues you may understand better then me.
I tend to pause the log, clear it, then unpause right before an action, in this case
1. Turning on bluetooth(with nothing paired) (pause, then save log)
2. Clear log, unpause, pair device, pause, save log
3. Clear log, unpause, turn off bluetooth, pause, save log
4. Clear log, unpause, turn on bluetooth(testing the pairing), pause, save log
Ill probably go over this again more thoroughly if more information comes out that helps me look out for something specific, perhaps this "GATT disconnect " that you speak off
The fact that this issue is happening on the nexus, as you say, seems to indicate that this is an issue with android itself, so im hoping, once xposed comes out for nouget, that this issue will be resolved when i update, which will be fun, seing as my adb/fastboot is not working........hoping flashfire app will do the job in this case, aswell as, hopefully, fix the adb/fastboot, but i digress
Edit
I have a very strong feeling that im gonna turn my device into a door stop when i eventually test/hope/hail mary with flashfire, a new shield purchase may be in my future just hope their still selling the 2015 model when/if i do
Click to expand...
Click to collapse
Thanks for the app, really helpful. Beside logcat you can also take a look of HCI bluetooth snoop.
a little bit off topic:
When try to stop the shield being discoverable I found that even it stop being discoverable by default bt_addr it will become discoverable by a different bt_addr if you scan for it long enough (about 1~3mins), and there are at least two different bt_addr.
you can try yourself by change the scan mode in bt_config.conf, there also an app call bluetooth settings (by4a.bluetoothsettings) can do that for you, just need to restart after install that app or the setting may not stick
Notes
I tested with another device, bluetooth mouse(which i believed to have a higher bluetooth version then the bluetooth keyboard version i was testing previously), ive been making an assumption, that under bluetooths settings "paired devices", if it comes up empty, then the pairing/s was/were forgotten, but clicking on the bluetooth mouse buttons, to auto connect, brought up a "enter pin popup"(shows up everytime i connect, so its not "fixed"), which connects ok after entering pin, so the pairing was still there, just not showing up in bluetooth settings
So at least i know its not deleted of the system
Search goes on
Edit
Bluetooth keyboard still cant auto connect(needs repairing), unlike the bluetooth mouse(which needs the pin entered every auto connect, which was not previous behaviour)
Although mouse works, the bluetooth "paired devices" sections is still empty, untill i press buttons on the mouse to auto connect
Hopefully someone finds this usefull, i sure hope im not jacking your thread dummyplug
banderos101 said:
Notes
I tested with another device, bluetooth mouse(which i believed to have a higher bluetooth version then the bluetooth keyboard version i was testing previously), ive been making an assumption, that under bluetooths settings "paired devices", if it comes up empty, then the pairing/s was/were forgotten, but clicking on the bluetooth mouse buttons, to auto connect, brought up a "enter pin popup"(shows up everytime i connect, so its not "fixed"), which connects ok after entering pin, so the pairing was still there, just not showing up in bluetooth settings
So at least i know its not deleted of the system
Search goes on
Edit
Bluetooth keyboard still cant auto connect(needs repairing), unlike the bluetooth mouse(which needs the pin entered every auto connect, which was not previous behaviour)
Although mouse works, the bluetooth "paired devices" sections is still empty, untill i press buttons on the mouse to auto connect
Hopefully someone finds this usefull, i sure hope im not jacking your thread dummyplug
Click to expand...
Click to collapse
Enter pin is actually an old pairing method before bt auto pairing. Anyway seems the bluetooth is quite buggy on shield, let hope it will be better for future firmware.
DummyPLUG said:
Enter pin is actually an old pairing method before bt auto pairing. Anyway seems the bluetooth is quite buggy on shield, let hope it will be better for future firmware.
Click to expand...
Click to collapse
Yeah, thats what im counting on when i have the opportunity to upgrade to nouget, hopefully the stock OTA download/OTA flash method works and fixes bluetooth and all my other various issues.
Also, for informations sake, i dont remember that particular bluetooth mouse of mine needing to enter a pin before i started having bluetooth issues, come to think of it, i realise the the initial pairing of my mouse auto pairs still, only after every auto connect does the pin show up
Ive encountered the blutooth/pin code popup many'ya times in the past and, well, quite recently i guess, i had assumed, that it was based on the bluetooth device you were pairing that dictated whether a popup pin would occur, and not so much android, different bluetooth peripherals having different bluetooth versions, some having or not having support for any particular bluetooth authorisation method introduced in higher/lower bluetooth standards.
Maybe part of the problem for me specifically is that my shield is not able to identify/communicate correctly with my devices
Its like you said, buggy ......and weird.......heres to hoping the ota fixes it
So does this remote - http://www.gearbest.com/smart-home-controls/pp_257680.html stay paired after reboot using this method?
GalaxyWhy said:
So does this remote - http://www.gearbest.com/smart-home-controls/pp_257680.html stay paired after reboot using this method?
Click to expand...
Click to collapse
I use the older one which don't have voice and take 2*aaa battery, beware the firmware may different, I had 4 of them and out of 2 behave a little bit different but still stay pair after reboot and don't affect usage
I have this exact remote and It has never even worked for me, does not make a beeping sound and pressing home + back any ideas why this remote wouldnt turn on at all?
hxxp://xxx.ebay.com/itm/HOT-Original-Xiaomi-Mi-remote-control-Apply-to-xiaomi-TV-and-Mi-tv-box-Pro-Cool/311829970277?_trksid=p2047675.c100005.m1851&_trkparms=aid%3D222007%26algo%3DSIM.MBE%26ao%3D2%26asc%3D41375%26meid%3D2cd664f8927e4787a3a56bf779251134%26pid%3D100005%26rk%3D5%26rkt%3D6%26sd%3D222539565729
As I know only the old one will beep, and it should be "home + menu"
my 1st xiaomi remote which using cr2032 will not work very well with shield, may be mine got a outdate firmware

Categories

Resources