Comments (4)
They are the four "parameters" for Android Intent
which can be used to perform inter-application communication (e.g. launch something else).
The current status of that operation is not meant to be used by normal users because it needs knowledge of what Intent is and what Intent can do (which are usually only known to developers or advanced users). But if you want to know more, you can read this and #15 .
As discussed in #15, this part will be redesigned in the future for easier use for normal users.
from easer.
@renyuneyun I've been trying to get the MEDIA_BUTTON intent to fire for a while now (to pause/play a media app).. I cannot figure out what I need to put into these 4 fields to make this work. Do you have any examples?
from easer.
@craftyguy
First I'd express a big thank you -- there is a bug in the implementation of this operation (wrong validation conditions), so some valid Intent
s will be treated as invalid; additionally, I forgot to add the field for putting "extras" to Intent
s, so some (possibily many) useful actions can't be used in the current implementation. They will be fixed along with the introduction of the event for listening to specific Intent
s (v0.4.5). I would also try (after confirming this is needed) to add an operation dedicated for media player control in this version (see the discussion below).
As the document (of ACTION_MEDIA_BUTTON
) says, there is an "extra" field to put in this Intent
in order to make it actually work (useful). However, this extra field here needs to be an object of a KeyEvent
class, so I'd like to add another operation dedicated for media control usage (because I'm afraid there isn't a clean/nice and uniformed way to construct such an object to be used in an Intent
in the current UI).
Here is how to actually make this Intent work (if a KeyEvent
object could be constructed someway specified in the UI) (somewhat "transribed" from here with a slight modification as shown here):
- Set
Action
toACTION_MEDIA_BUTTON
- Leave
Category
,Type
andData
empty (they should be left empty in order to make this Intent to work) - Add one field (a key-value pair) in
Extra
: the key isEXTRA_KEY_EVENT
, and the value is aKeyEvent
object containing keycode 126 (which is the actual value ofKeyEvent.KEYCODE_MEDIA_PLAY
) (or 85 forKeyEvent.KEYCODE_MEDIA_PLAY_PAUSE
) and keyevent action 1 (forKeyEvent.ACTION_DOWN
)
I also found a discussion saying another Intent/Broadcast may work to control media player, which won't depend on an object of KeyEvent
(or any other non-basic classes). However I'm not sure whether this is a de facto standard or is specifically for "some" Android (or maybe also google's) player.
Just as an example, here is how to make this work:
- Set
Action
tocom.android.music.musicservicecommand
- Leave
Category
,Type
andData
empty (they should be left empty in order to make this Intent to work) - Add one field in
Extra
: the key is a stringcommand
, and the value is another stringpause
.
from easer.
Wow thanks for the detailed response! Having pre-configured commands to pause/play media would be ideal from a user standpoint, but I will give what you have here a try
from easer.
Related Issues (20)
- Question: How to switch hotspot on/of when connecting to other device via Bluetooth; Bug: external logging not possible
- wifi or data does not work
- [FR] Monitor directory HOT 4
- Improving the usage example HOT 1
- [FR] "wait" profile command
- Wiki pages vandalized HOT 1
- [FR] Multiple conditions?
- Crash when opening `Pivot`
- Download link is dead.
- FeatureRequest: Add option to scan for available networks and connect to a better one if in range
- [FR] Wi-Fi disconnection trigger
- [FR] dynamics string sanitization
- [FR] Condition valid for <x> time (duration condition)
- Can I initiate power off/on, enabled/disable battery saving mode? HOT 1
- Broadcast not accepted by Android system HOT 2
- Profile triggering at the wrong time
- Media volume issue
- [FR] Detect USB connections/input devices.
- [support] Where is the user support forum? (sending contents of notification) HOT 3
- [FR] use WGTunnel for Wireguard intent
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from easer.