Android : Way To Detect A Call State From A Service?
Oct 22, 2009i have a service (that extends Service). public class MyService extends Service ..
View 2 Repliesi have a service (that extends Service). public class MyService extends Service ..
View 2 RepliesI can use this code make outgoing call.
Intent dial = new Intent(Intent.ACTION_CALL); dial.setData(Uri.parse("tel:5556") );
context.startActivity(dial);
But how to detect call pick up the call or refuses to answer?
I tried PhoneStateListener but not working.
I'm currently working on a project which requires the detection of user state (walking, running, driving), I've looked through some of the existing solutions on Android platform such as pedometer or calculating velocity with given acceleration, but I'm still unsure how I can approach this problem. Is there a way to accomplish this without much of data mining/signal processing? How can I solve this with simple logic? Or is this better solved with gps instead of accelerometer? The program will only need to return simple user-state descriptions like walking.
View 1 Replies View RelatedIs there an easy way to be notified when USB or AC power is connected to an Android phone?
View 1 Replies View RelatedI wanna write an app to enable and disable the Bluetooth device synchronized. Referring the Android source code, I registered following receiver to receive the bluetooth state change event:
CODE:............
But it doesn't work. Although the BT status has been changed (the icon of BT has been appeared or disappeared), the receiver could not receive nothing.
I have a galaxy s2 and after I installed costom roms I dont have any signal what so ever.
I tried with like 3 roms and the same result.
I tought it was a modem problem and I tried to install some modems and see if that works. But it didnt.
My Service State says Out of service and sometimes it says Radio off.
I'm trying to get current service state of my phone. It can be easily fetched with get State() method of Service State when a on Service State Changed (Service State service State) callback is invoked: Code...
View 2 Replies View Relatedi need a way to understand that the incoming call is a forwarded call so i can deny it using tasker or another application.If possible i want to auto decline the call using tasker + secure settings or any other plugin
View 3 Replies View RelatedHow do I check whether the local service inside my application is running?
View 1 Replies View RelatedI have built an application that listen to call state changes, and I want to notify a service when the call_state became IDLE.All the components I have are functional, I just need to notify (not start) a service for this.What's the correct practice, maybe using AIDL? Because, in a PhoneStateListener, I can't bind to a service. Do I have to start an activity for that?
View 2 Replies View RelatedHere's my Python script written using android-scripting:
CODE:............
while True:
CODE:.............
It basically vibrates every minute (like a motivator). However, when the phone is locked with screen blanked out, I don't sense any vibration. Perhaps Android is freezing the script (and hence the while loop)? Note that I am indeed running this script as a service (long-tap and click 'Start as service').
Is there a way to make this script work all the time regardless of the phone suspend state?
Update 1: I do hear the vibration occasionally, not every minute .. but rather like every 5-10 minutes randomly.
Update 2: This problems occurs if I run the script normally (not as a service). Seems like "time.sleep" is not sleeping for the specified time.
I wonder if it's possible to get music player state, like which is the current music playing, title, author and so on ? Better, is it possible for an activity (or a service) to be notified on music state changements (start playing, pause, etc.)
View 3 Replies View RelatedI have a Service which tracks the location of the user. Currently, the Service boots when the application starts and stops when the application terminates. Unfortunately, if users keep the application in the background, the Service never stops and drains battery.
I would like the Service to stop when my application is not in the foreground. I was hoping the Application class would let me Override onPause and onResume handlers, but it does not have them.
I have a BroadcastReceiver that listens for the BOOT_COMPLETED, that part works I know because I disabled my phone listener and displayed a Toast within. That BroadcastReceiver is supposed to start a service, that also works. I run into Force Close issues when my service attempts to tell my TelephonyManager to listen. Any one have any ideas? Here is my code StartSeviceAtStartUp.java import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent;
View 3 Replies View RelatedI want to send an intent to my service everytime the state of Wifi connectivity changes. So when I currently use a broadcast receiver to listen for the state changes in Wifi, so when this recieves an intent I want to be able to send this info on to my service. Is this possible and if so the correct way to do it?
View 2 Replies View RelatedI am trying to find a way to get the connectivity state in a service, found the code below but getSystemService is red underlined.
public boolean isOnline() {
ConnectivityManager cm = (ConnectivityManager) this.getSystemService(Context.CONNECTIVITY_SERVICE );
return cm.getActiveNetworkInfo().isConnectedOrConnecting( );
}
I have small simple Service and big MainActivity with UI. Service is called periodically from AlarmManager. My Service need to know if MainActivity is on the screen and inform MainActivity about state changing.
View 3 Replies View RelatedI want to create an app or background service that just listens for the launch of a 'default' app, say Contacts or the built-in Gmail app. If the contact app is clicked, I want to transfer control to my app temporarily (e.g. present a Yes/No popup to the user or increment an internal counter of my app ) and then redirect the user back to the app that was clicked. I want to do this only for a couple of 'well-known' built-in default apps, not any third party apps..
View 3 Replies View RelatedI can see that we can get a phonestate via the PhoneStateListener, but there is no way of telling the state of the call. OFFHOOK is a number of states combined into one. Is there a particular reason for this? Are we not allowed to see the correct state of a call?
View 2 Replies View RelatedI noticed in the class TelephonyManager there are CALL_STATE_IDLE, CALL_STATE_OFFHOOK adn CALL_STATE_RINGING. They seem to be used for incoming calls.What I actually want to do is to be notified when an outgoing call is made, is received, or timed out. How to do that?
View 2 Replies View RelatedI have gone through many threads in this group about avoiding the use of everlasting Services, Timer/TimerTask sleep issues and detecting phone calls, but not finding the answers I am looking for this app, I will really appreciate any help you can provide me. I am working on an App to detect incoming calls and when the call time is equal to 5 minutes indicate the user by vibrating the phone. In my strategy I am creating a Receiver that listens for RECEIVE_BOOT_COMPLETED action and launch an everlasting Service which sets up a PhoneState Listener.
1) Is there any other strategy to be always listening for incoming calls and thus avoide to using an on boot created Service? (besides the Service eventually gets killed and I am not able to detect incoming calls) A first approach I took here was setting up a Timer and TimerTask when CALL_STATE_RINGING state was detected and after 5 min (if the call continues) vibrate the phone for 2 seconds. However sometimes the timer phone vibrates after an hour a call was placed (the vibration happens in the run() TimerTask method. I know Android can go to sleep and that could be the reason my timer is not run on time but 2) How can Android be slept if I am in a call? Is the call just handled by the modem or how come? Next, to overcome this issue I tried preventing the Service from going to sleep by putting it in foreground state calling startForeground (NOTIFICATION_ID , notification), still the same behaviour the timer is run long after the call was placed 3) does startForeground prevent Android going to sleep or it is just aimed to keep the Service's process in memory? 4) A wake lock would do this job ? (I have not tried this) Encouraged by many post I tried using an Alarm and it works (thought I do not want to use it because I think it should be possible to accomplish with something lighter) but when the phone vibrates it just keeps vibrating till I remove the phone from my cheek (the screen is turned on again) 5) Why? Is it that Android started vibrating the phone and then went to sleep? so the vibration is turned off when Android awakes, when the screen is turned on again? 6? Ideas of how to stop the timer?
I am writing a service which listens an incoming call. I have a function but it behaves differently under these cases when i call the function in case case Telephony Manager . CALL _STATE_OFFHOOK: it works! when I call the same function in case case Telephony Manager. CALL _STATE_RINGING: it doesnt work. it seems that when an incoming call happens the system blocks some components. what should I do to prevent from this situation. Should I move my calculation to a background thread? Does it work in that way?
View 3 Replies View RelatedI am writing an app that is meant to be run during a call. After the user makes a call, and starts my app, I want my app to be able to know if the call is dropped from bad connection.
View 3 Replies View RelatedI havn´t been able to find out, how to detect the event (if there are any), when an outgoing call is answered - does anybody know how to do this?
View 3 Replies View RelatedI would like to detect if microphone in the device or in a headset is mute during a call. Currently I've taken the following approach (unfortunately - it does not work): 1) register PhoneStateListener to detect when a call is started/ finished 2) when call is started then I start a thread that periodically calls audioManager.isMicrophoneMute() method to discover a microphone status. (audioManager is obtained by calling getSystemService (AUDIO_SERVICE) ) 3) when call is finished I stop a thread started in bullet 2
Unfortunately audioManager.isMicrophoneMute() always returns 'true', does not matter if I select or deselect the 'Mute' option in the menu during a call. Does anybody know if it is possible to detect the state of a microphone during a call?
I have seen, using search, that this question has been asked already in this forum, without answer. To ask again: How can I detect when outgoing call has been accepted ?I can detect when outgoing call has been started using BroadcastReceiver. I can detect when call has ended using PhoneStatusListener. But there is nothing more except this two notifications.Internal phone application detects this event, my HTC magic (running standard cupcake) vibrates shortly when other party accepts call.So is it possible to detect this event in 'cupcake' or 'donut'. If not where can I post feature request to android OS developers to include this notification in next API revision.
View 2 Replies View RelatedOnce ACTION_NEW_OUTGOING_CALL has been broadcasted, I need to capture the following event of the other party answer. Could you advice on how to achieve that please? I know it is possible as the android dialer app changes the green android icon to the person's photo excatly when they pick up. I've had a look at the source of the app on Android handling the outgoing calls.
View 1 Replies View RelatedI'm coding a service which does a its job once in every 10 minutes. Works fine. However, when a screen lock gets activated, the service is stopped (which is normal I've found out and I'm find with that). But when the screeen is unlocked again, the 10-minute interval could be already over and I want the service to do the job immediatelly. But... how can I detect that the service was awaken? I schedule the tasks with handler.postAtTime() method.
View 3 Replies View RelatedI am not able to detect when outgoing call has been answered, I have registered BroadcastReceiver for PHONE_STATE broadcast, but onReceive() gets called only when number is dialed and when call has ended.If it is not possible with current API (1.5 or 1.6) please enlighten me ?
View 2 Replies View RelatedIs possible in android, detect the latitude and longitude from Incoming Call?
View 12 Replies View Related