Search in sources :

Example 1 with SimStateReceiver

use of com.vodafone360.people.service.receivers.SimStateReceiver in project 360-Engine-for-Android by 360.

the class UserDataProtection method performStartupChecks.

/**
     * Performs the checks needed when the 360 Service is started.
     * 
     * This method checks if the user has changed and if the SIM card id cannot be read, sets a
     * SIM state changes listener.
     */
public void performStartupChecks() {
    LogUtils.logD("UserDataProtection.performStartupChecks()");
    final int simState = SimCard.getState(mContext);
    if (simState == TelephonyManager.SIM_STATE_ABSENT || simState == TelephonyManager.SIM_STATE_READY) {
        processUserChanges();
    } else {
        LogUtils.logD("UserDataProtection.performStartupChecks() - SIM_STATE_UNKNOWN, register a SimStateReceiver.");
        // SIM is not ready, register a listener for Sim state changes to check
        // the subscriber id when possible
        mSimStateReceiver = new SimStateReceiver(this);
        mContext.registerReceiver(mSimStateReceiver, new IntentFilter(SimStateReceiver.INTENT_SIM_STATE_CHANGED));
    }
}
Also used : IntentFilter(android.content.IntentFilter) SimStateReceiver(com.vodafone360.people.service.receivers.SimStateReceiver)

Aggregations

IntentFilter (android.content.IntentFilter)1 SimStateReceiver (com.vodafone360.people.service.receivers.SimStateReceiver)1