A
A
Alexander Vasyuchenko2016-10-14 15:56:17
Android
Alexander Vasyuchenko, 2016-10-14 15:56:17

Why is it impossible to get through to the mobile after installing TelephonyManager.listen?

Please tell me why after launching the application with this code

private TelephonyManager telephonyManager;
    private CallStateListener callStateListener;

    public CallWatcher(Context context) {
        telephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
        callStateListener = new CallStateListener();
    }

    public void startWatching() {
        telephonyManager.listen(callStateListener, PhoneStateListener.LISTEN_CALL_STATE);
    }

    class CallStateListener extends PhoneStateListener {
        @Override
        public void onCallStateChanged(int state, String incomingNumber) {
            super.onCallStateChanged(state, incomingNumber);
            updateForCallEvent();
        }
    }

I can't reach this mobile? Gives "Subscriber unavailable".
When I close the app, then I can...

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question