When i’m calling i would like to have an activity to be started from a background service.
I can get the activity to start while i’m calling and the phone is of my head (something to do with the proximity sensor I asume)
But when the proximity sensor detects something and i try to start the activty, the onStart of that activity is called, and directly after that the onStop is called.
Does anyone know how to start an activity while in call and the proximity sensor detects something?
01-02 15:42:14.829: I/KeepAliveService(5985): show pager call from Service
01-02 15:42:14.849: I/ActivityManager(167): Starting: Intent { flg=0x14050004 cmp=com.clb.clbmobile/.NewMessage (has extras) } from pid 5985
01-02 15:42:14.849: W/ActivityManager(167): Trying to launch com.clb.clbmobile/.NewMessage
01-02 15:42:14.859: D/KeyguardViewMediator(167): adjustUserActivityLocked mShowing: false mHidden: false
01-02 15:42:14.859: D/PowerManagerService(167): enableUserActivity true
01-02 15:42:14.859: D/StatusBarManagerService(167): manageDisableList what=0x0 pkg=android
01-02 15:42:14.859: D/InCallScreen(242): onWindowFocusChanged(false)...
01-02 15:42:14.859: D/InCallScreen(242): - onWindowFocusChanged: faking onDialerKeyUp()...
01-02 15:42:14.859: D/DTMFTwelveKeyDialer(242): Notifying dtmf key up.
01-02 15:42:14.889: I/KeepAliveService(5985): activity started
01-02 15:42:14.939: I/ClbActivity(5985): getting shared prefs
01-02 15:42:14.939: I/ClbActivity(5985): end shared prefs
01-02 15:42:14.939: I/AlertDialog(5985): Starting Alert Dialog
01-02 15:42:15.019: I/AlertDialog(5985): Done with init
01-02 15:42:15.079: D/BatteryService(167): update start
01-02 15:42:15.079: D/BatteryService(167): update start
01-02 15:42:15.079: D/BatteryService(167): update start
01-02 15:42:15.099: E/PlayerDriver(95): Creating Non-Tunnel mode playback - uncompressed MIO
01-02 15:42:15.099: W/MediaPlayer(5985): info/warning (1, 44)
01-02 15:42:15.109: I/AlertDialog(5985): Current volume = 15
01-02 15:42:15.109: E/MediaPlayer(5985): prepareAsync called in state 8
01-02 15:42:15.109: I/AlertDialog(5985): cant prepare Media Player
01-02 15:42:15.109: V/AudioPolicyManager(95): startOutput() output 1, stream 3, session 241
01-02 15:42:15.109: V/AudioPolicyManager(95): getDeviceForStrategy() from cache strategy 1, device 1
01-02 15:42:15.109: V/AudioPolicyManager(95): getNewDevice() selected device 1
01-02 15:42:15.109: V/AudioPolicyManager(95): setOutputDevice() output 1 device 1 delayMs 0
01-02 15:42:15.109: V/AudioPolicyManager(95): setOutputDevice() setting same device 1 or null device for output 1
01-02 15:42:15.109: V/AudioHardwareMSM72XX(95): open driver
01-02 15:42:15.109: V/AudioHardwareMSM72XX(95): get config
01-02 15:42:15.109: V/AudioHardwareMSM72XX(95): set config
01-02 15:42:15.109: V/AudioHardwareMSM72XX(95): buffer_size: 4800
01-02 15:42:15.109: V/AudioHardwareMSM72XX(95): buffer_count: 2
01-02 15:42:15.109: V/AudioHardwareMSM72XX(95): channel_count: 2
01-02 15:42:15.109: V/AudioHardwareMSM72XX(95): sample_rate: 44100
01-02 15:42:15.109: V/AudioHardwareMSM72XX(95): count : 4800
01-02 15:42:15.139: I/AlertDialog(5985): start pausing
01-02 15:42:15.149: I/MediaPlayer(5985): Info (1,44)
01-02 15:42:15.369: I/ActivityManager(167): Displayed com.clb.clbmobile/.NewMessage: +517ms
01-02 15:42:15.489: W/IInputConnectionWrapper(5985): showStatusIcon on inactive InputConnection
01-02 15:42:15.489: W/IInputConnectionWrapper(5985): getExtractedText on inactive InputConnection
01-02 15:42:15.499: D/InCallScreen(242): onStop()...
01-02 15:42:15.499: D/InCallScreen(242): onStop: state = OFFHOOK
01-02 15:42:15.509: D/InCallScreen(242): onResume()...
01-02 15:42:15.519: D/PhoneApp(242): setIgnoreTouchUserActivity(true)...
01-02 15:42:15.519: D/DTMFTwelveKeyDialer(242): startDialerSession()... this = com.android.phone.DTMFTwelveKeyDialer@4055e2a0
01-02 15:42:15.519: D/DTMFTwelveKeyDialer(242): - startDialerSession: mDTMFToneEnabled = true
01-02 15:42:15.519: D/InCallScreen(242): - onResume: initial status = SUCCESS
01-02 15:42:15.519: D/InCallScreen(242): isBluetoothAudioConnected: ==> isAudioOn = false
01-02 15:42:15.519: D/InCallScreen(242): setInCallScreenMode: NORMAL
01-02 15:42:15.519: D/InCallScreen(242): [okToDialDTMFTones] foreground state: ACTIVE, ringing state: false, call screen mode: NORMAL, result: true
01-02 15:42:15.519: D/InCallScreen(242): isBluetoothAudioConnected: ==> isAudioOn = false
01-02 15:42:15.519: D/StatusBarManagerService(167): manageDisableList what=0x1 pkg=com.android.phone
01-02 15:42:15.519: D/PowerManagerService(167): setPokeLock pokey=16 tag=PhoneApp
01-02 15:42:15.519: D/PowerManagerService(167): setScreenOffTimeouts mKeylightDelay=3000 mDimDelay=7000 mScreenOffDelay=20000 mDimScreen=true
01-02 15:42:15.519: D/StatusBarManagerService(167): manageDisableList what=0x1 pkg=com.android.phone
01-02 15:42:15.519: I/CallOnGoingView(229): onDetachedFromWindow
01-02 15:42:15.669: D/InCallScreen(242): Handler: handling message { what=101 when=-48ms obj=android.os.AsyncResult@406d01b8 } while not in foreground
01-02 15:42:15.669: D/InCallScreen(242): onPhoneStateChanged()...
01-02 15:42:15.669: D/PhoneApp(242): updateWakeState: callscreen false, dialer false, speaker false, state OFFHOOK...
01-02 15:42:15.669: D/PhoneApp(242): setScreenTimeout(DEFAULT)...
01-02 15:42:15.669: D/PhoneApp(242): requestWakeState(SLEEP)...
01-02 15:42:15.669: D/InCallScreen(242): onPhoneStateChanged: Activity not in foreground! Bailing out...
01-02 15:42:15.669: I/StatusBarManagerService(167): UPDATE-null , 0x7f020143
01-02 15:42:15.669: I/StatusBarService(229): REMOVE:MiniCon-1
01-02 15:42:15.689: I/AlertDialog(5985): start stopping
01-02 15:42:15.699: I/StatusBarService(229): ADD:MiniCon-1
I fixed this problem in a different way.
If these two are the case, then a sound is being played from a service.
I then keep checking if the proximity sensor has deactived (eg. the phone is of the head). If this is the case, my acitivity is shown.