Search in sources :

Example 16 with RemoteLogger

use of com.voipgrid.vialer.logging.RemoteLogger in project vialer-android by VoIPGRID.

the class SipService method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    mHandler = new Handler();
    mToneGenerator = new ToneGenerator(AudioManager.STREAM_VOICE_CALL, SipConstants.RINGING_VOLUME);
    mSipBroadcaster = new SipBroadcaster(this);
    mPreferences = new Preferences(this);
    mRemoteLogger = new RemoteLogger(SipService.class).enableConsoleLogging();
    mNativeCallManager = new NativeCallManager((TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE));
    mRemoteLogger.d("onCreate");
    IntentFilter filter = new IntentFilter();
    filter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED);
    registerReceiver(phoneStateReceiver, filter);
    // Create runnable to check if the SipService is still in use.
    mCheckServiceHandler = new Handler();
    mCheckServiceRunnable = new Runnable() {

        @Override
        public void run() {
            // Check if the service is being used after 10 seconds and shutdown the service
            // if required.
            checkServiceBeingUsed();
            mCheckServiceHandler.postDelayed(this, mCheckServiceUsedTimer);
        }
    };
    mCheckServiceHandler.postDelayed(mCheckServiceRunnable, mCheckServiceUsedTimer);
    PhoneAccount phoneAccount = new JsonStorage<PhoneAccount>(this).get(PhoneAccount.class);
    if (phoneAccount != null) {
        // Try to load PJSIP library.
        mSipConfig = new SipConfig(this, phoneAccount);
        try {
            mSipConfig.initLibrary();
        } catch (SipConfig.LibraryInitFailedException e) {
            stopSelf();
        }
    } else {
        // User has no sip account so destroy the service.
        mRemoteLogger.w("No sip account when trying to create service");
        stopSelf();
    }
}
Also used : IntentFilter(android.content.IntentFilter) Handler(android.os.Handler) NativeCallManager(com.voipgrid.vialer.call.NativeCallManager) ToneGenerator(com.voipgrid.vialer.dialer.ToneGenerator) PhoneAccount(com.voipgrid.vialer.api.models.PhoneAccount) TelephonyManager(android.telephony.TelephonyManager) RemoteLogger(com.voipgrid.vialer.logging.RemoteLogger) Preferences(com.voipgrid.vialer.Preferences)

Example 17 with RemoteLogger

use of com.voipgrid.vialer.logging.RemoteLogger in project vialer-android by VoIPGRID.

the class OnBootReceiver method onReceive.

@Override
public void onReceive(Context context, Intent intent) {
    RemoteLogger remoteLogger = new RemoteLogger(OnBootReceiver.class).enableConsoleLogging();
    remoteLogger.e("onBootReceiver");
    MiddlewareHelper.registerAtMiddleware(context);
}
Also used : RemoteLogger(com.voipgrid.vialer.logging.RemoteLogger)

Aggregations

RemoteLogger (com.voipgrid.vialer.logging.RemoteLogger)17 JsonStorage (com.voipgrid.vialer.util.JsonStorage)5 Bundle (android.os.Bundle)4 Preferences (com.voipgrid.vialer.Preferences)4 Intent (android.content.Intent)3 Account (android.accounts.Account)2 SharedPreferences (android.content.SharedPreferences)2 AnalyticsApplication (com.voipgrid.vialer.analytics.AnalyticsApplication)2 AnalyticsHelper (com.voipgrid.vialer.analytics.AnalyticsHelper)2 PhoneAccount (com.voipgrid.vialer.api.models.PhoneAccount)2 SystemUser (com.voipgrid.vialer.api.models.SystemUser)2 SetupActivity (com.voipgrid.vialer.onboarding.SetupActivity)2 AccountHelper (com.voipgrid.vialer.util.AccountHelper)2 Activity (android.app.Activity)1 Fragment (android.app.Fragment)1 IntentFilter (android.content.IntentFilter)1 MatrixCursor (android.database.MatrixCursor)1 Handler (android.os.Handler)1 MediaSessionCompat (android.support.v4.media.session.MediaSessionCompat)1 PlaybackStateCompat (android.support.v4.media.session.PlaybackStateCompat)1