android


Where does Android interpret the media button?


Where does Android convert the physical media button (in the headset cable) into logical actions (like NEXT, STOP, SPEECH QUERY)?
Is there a way of changing this assignment (ie creating other actions out of it)?
NB: I tried to install a MediaButtonReceiver. But it only sees the interpreted key. So I only see the keypress, after the key has been released earlier enough not to trigger a SPEECH QUERY.
Update: I see the raw key events, that I need, in onDispatchKeyEvent as long as my app is in foreground. But how do get them when the lock screen is active?
The MediaButtonReceiver gets called when the app is in background (but only after the key has been released).
Before your app starts playing any audio, it should hold the audio focus for the stream it will be using. This is done with a call to requestAudioFocus() which returns AUDIOFOCUS_REQUEST_GRANTED if your request is successful.
You must specify which stream you're using and whether you expect to require transient or permanent audio focus.
// Request audio focus for playback
int result = am.requestAudioFocus(afChangeListener,
// Use the music stream.
AudioManager.STREAM_MUSIC,
// Request permanent focus.
AudioManager.AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK);
if (result == AudioManager.AUDIOFOCUS_REQUEST_GRANTED) {
// Start playback.
}
Check for more information.
To use Real Time event in your APP, the RTP is the way to go. It provides APIs for RTP (Real-time Transport Protocol), allowing applications to manage on-demand or interactive data streaming.

Related Links

Android WebView - Infinite loop after click
android java.lang.NoClassDefFoundError: com.google.firebase.FirebaseOptions in android 4.0.4
Android, file opening from internal cache storage area
Communicate with many devices from one - Android
Facebook share error : “the page you requested cannot be displayed right now”
Libgdx SpriteBatch won't position correctly on Screen
Getting null error in android tab project
Using Header and BasicHeader with HttpUrlConnection in android
“react-native run-android” - BUILD is SUCCESSFUL but get error type 3 Error: Activity class MainActivity does not exist
ImageView/layout rounded circular in XML [duplicate]
Android 6 Samsung Touchwiz launcher icons are bigger than of non samsung apps
can't find Build Tool 23.0.2 when I use
Instantly updating a image view on a activity from a fragment (sharing same screen)
Ubuntu 16.04.1 can't detect Android device
Location by using getLAstKnownLocation
border and icon when an item is selected in GridView

Categories

HOME
android
google-app-engine
spark-streaming
c++11
apache-jena
google-spreadsheet
carousel
big-o
boto3
bing-maps
little-proxy
jsonpath
linear-algebra
wolframalpha
sigma.js
drive
asciidoctor-pdf
squashfs
event-store
fable-f#
subclass
cppreference
vex
database-comparison
angularjs-material
memory-address
parse-tree
alphabetical
sessionstorage
z-notation
projects-and-solutions
verifiable-c
metawidget
opensmpp
apache-stanbol
portforwarding
glm-math
android-exoplayer
builder
lightning
reindex
edit
oozie-coordinator
libjpeg
lsyncd
shinobi
swingworker
rxtx
taocp
cudd
mapxtreme
omniauth-facebook
kango-framework
angular-ui-typeahead
aurora
cortex-m
grgit
zen-cart
pax-exam
dronekit-android
ms-access-2000
entity-framework-4.3
osc
iiop
jqmodal
lambda-architecture
ss7
kissfft
ora-00904
parallel-testing
wxformbuilder
dot42
adobe-media-server
floating-point-exceptions
cgimage
matlab-load
catransform3d
android-holo-everywhere
w3c-geolocation
http-daemon
mtu
qglwidget
undefined-index
silent
maven-1
nstokenfield
cuda.net
interop-domino
escrow
technical-debt

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App