Broadcast receiver that listens to hard button in android
Is there a cross device hard button in android that a background service can listen to and act when it is pressed/released?
Thanks
Asked by: Darcy559 | Posted: 24-01-2022
Answer 1
No. You can set up a BroadcastReceiver
to watch for the CAMERA or MEDIA buttons, but those are not always available -- some devices do not have the CAMERA button, and the MEDIA button is for use with wired headsets.
Sorry!
Answered by: Walter508 | Posted: 25-02-2022Similar questions
android - How to create a new Intent for another app's broadcast receiver?
In the examples, they create Intent as:
Intent intent = new Intent(this, AlarmReceiver.class);
But suppose my AlarmReceiver class is in another app, how do I create this intent?
I've tried with
new Intent("com.app.AlarmReceiver")
but nothing happens.. It was not called..
Any idea?
--Broadcast definition added using the manifest ...
What is the use of broadcast receiver in Android?
Can anybody tell what is the use of a BroadcastReceiver and give an example in Android?
Can someone give a time zone change example using a BroadcastReceiver?
android - How to create Custom Broadcast Receiver
I need to create custom broadcast receiver which will show me about any PHONE_STATE event occurred.
broadcast receiver for missed call in android
Does anyone know what is the intent for missed call. Actually i want to send sms on missed call and incomming call in my application.
Android Broadcast Receiver showing a dialog?
I've got an app that responds to an Alert - and I really need to show an alert with a password entry before going on to the next screen; the trouble is I don't seem to be able to show a dialog from a broadcast receiver -- so how can I show a dialog password entry upon receiving an alert?
Start Android TTS from Broadcast Receiver or Service
I'm trying to get TTS to run in the background. But, I never get any sound. I have a broadcast receiver which starts a service. I put my TTS code in both of those, but it never speaks. I know the method is being called (I put a breakpoint on it), but it still doesn't work.
Here's my log, but it doesn't seem to contain anything about the TTS service.
10-04 22:45:30.663: WARN/InputManagerService(209):...
android - Broadcast Receiver doesn't work
Main Activity Code. BroadcastExample.java
package com.example.broadcast;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
public class BroadcastExaple extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.d("PHONE", "Main Activity...C...
android - Is it possible to define a broadcast receiver as an inner class in manifest file?
This question already has answers here:
Sending an intent from broadcast receiver to a running service in android
Here is a my broadcast receiver.
public class SmsReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context ctx, Intent intent) {
Log.d(DEBUG_TAG, SmsReceiver.class.getSimpleName()+ " action: " + intent.getAction());
// here is codes for sending intent to my running service
} }
here is broadcast receiver and service nodes in my manif...
android - broadcast receiver won't receive camera event
I'm trying to make an app that detects when a user takes a photo. I set up a broadcast receiver class and registered it in the manifest file by:
<receiver android:name="photoReceiver" >
<intent-filter>
<action android:name="com.android.camera.NEW_PICTURE"/>
<data android:mimeType="image/*"/>
</intent-filter>
</receiver>
No matter what I try ...
Broadcast receiver for ACTION_UP of the camera button in android
Samsung Galaxy, Android 1.5.
I'm trying to detect when the user releases the camera button.
I have a receiver that gets the ACTION_CAMERA_BUTTON intent and examines the EXTRA_KEY_EVENT that comes with it,using the following code (in the onReceive() in the receiver)
@Override
public void onReceive(Context context, Intent intent) {
String intent_action = intent.getAction();
if (intent_action.equals...
java - Broadcast Intent when network state has changend
Does Android broadcast an intent when the network state has changend, i.e. from GSM to Wifi? And if so what permission do I need and what is the intent action called?
android - handling broadcast receiver
I have an app which has MainActivity(without gui.. please just flow with it:) )
now this MainActivity running a service, this service using sendBroadcast() in order to comunnicate with the MainActivity..
now ofcourse i need to registerReceiver in the onResume() of the MainActivity.
but i also need to add unregisterReceiver(receiver) in the onDestroy...
Logging broadcast Intents and manually trigger them (Android)
during my development in android I've missed a function that can log every broadcast intent that occur. Sometimes it had been very useful to have a function like that...
I'm also wondering how to trigger those broadcast intents manually on the emulator.
Is there an entire overview of available broadcast intents?
Would be great if someone would have some answers,
greets,
poeschlorn
widget - Send a public broadcast from an AppWidget in Android
I have a widget for a music player and want to be able to send broadcasts when pushing the different buttons. What I want to do is when a button is pushed, the widget sends a public broadcast to another BroadcastReceiver so it can handle the different actions.
In my activity class with the BroadcastReceiver:
private BroadcastReceiver broadcastReceiver = new BroadcastReceiver() {
@Override
public...
android - how can I notify a running activity from a broadcast receiver?
I have an activity, it needs to response to a broadcast event.
Since an activity can not be a broadcast receiver at the same time,
I made a broadcast receiver.
My question is: how can I notify the activity from the broadcast receiver?
I believe this is a common situation, so is there a design pattern for this?
java - Cell broadcast support on Android?
Does anyone know if there is a support for cell broadcast on Android?
If yes, can anyone point me to any example that shows how to use it? (e.g. receive messages on some channel)
Thank you.
android - Update Widget on System Broadcast Intent
I'm working on an Android widget that will show the current network state (i.e 1xRTT, EvDo Rev. A, WiMax, etc.). It may seem like a pointless idea, but for whatever the reason, the Evo doesn't differentiate between 1x & EvDo, it just says 3G for both, which is annoying if you're in a fringe 3G area.
Anyways, to the point: I have the widget complete and it updates with the current network just fine, but how can ...
android - sending broadcast intent from runnable
I want to send a broadcast from a new thread is start.
This is what i tried :
new Thread(new Runnable() {
public void run() {
//some other code for timing.
// ..
// ..
Intent broadcastIntent = new Intent();
broadcastIntent.setAction(Intent.ACTION_ANSWER);
this.sendBroadcast(broadcastIntent);
}
}).star...
android - How to create a new Intent for another app's broadcast receiver?
In the examples, they create Intent as:
Intent intent = new Intent(this, AlarmReceiver.class);
But suppose my AlarmReceiver class is in another app, how do I create this intent?
I've tried with
new Intent("com.app.AlarmReceiver")
but nothing happens.. It was not called..
Any idea?
--Broadcast definition added using the manifest ...
Still can't find your answer? Check out these communities...
Android Google Support | Android Community | Android Community (Facebook) | Dev.io Android