Code example for TelephonyManager

Methods: listen

0
         
        if (app.isEnabled())
        { 
            app.getMessagingObserver().register(); 
 
            telephony.listen(app.getCallListener(), PhoneStateListener.LISTEN_CALL_STATE);          
 
            app.getDatabaseHelper().restorePendingMessages();
             
            app.getAmqpConsumer().startAsync();
        } 
        else 
        { 
            app.getMessagingObserver().unregister();
            telephony.listen(app.getCallListener(), PhoneStateListener.LISTEN_NONE);
 
            app.getAmqpConsumer().stopAsync();
        }                    
    } 
}