Android Open Source - cannonball-android Session Recorder






From Project

Back to project page cannonball-android.

License

The source code is released under:

Apache License

If you think the Android project cannonball-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package io.fabric.samples.cannonball;
/*www .  j a v a  2s . c  o  m*/
import com.crashlytics.android.Crashlytics;
import com.twitter.sdk.android.core.Session;

public class SessionRecorder {
    public static Session recordInitialSessionState(Session twitterSession,
                                                    Session digitsSession) {
        if (twitterSession != null) {
            recordSessionActive("Splash: user with active Twitter session", twitterSession);
            return twitterSession;
        } else if (digitsSession != null) {
            recordSessionActive("Splash: user with active Digits session", digitsSession);
            return digitsSession;
        } else {
            recordSessionInactive("Splash: anonymous user");
            return null;
        }
    }

    public static void recordSessionActive(String message, Session session) {
        recordSessionActive(message, String.valueOf(session.getId()));
    }

    public static void recordSessionInactive(String message) {
        recordSessionState(message, null, false);
    }

    private static void recordSessionActive(String message, String userIdentifier) {
        recordSessionState(message, userIdentifier, true);
    }

    private static void recordSessionState(String message,
                                           String userIdentifier,
                                           boolean active) {
        Crashlytics.log(message);
        Crashlytics.setUserIdentifier(userIdentifier);
        Crashlytics.setBool(App.CRASHLYTICS_KEY_SESSION_ACTIVATED, active);
    }
}




Java Source Code List

io.fabric.samples.cannonball.AppService.java
io.fabric.samples.cannonball.App.java
io.fabric.samples.cannonball.ApplicationTest.java
io.fabric.samples.cannonball.SessionRecorder.java
io.fabric.samples.cannonball.activity.AboutActivity.java
io.fabric.samples.cannonball.activity.InitialActivity.java
io.fabric.samples.cannonball.activity.LoginActivity.java
io.fabric.samples.cannonball.activity.PoemBuilderActivity.java
io.fabric.samples.cannonball.activity.PoemHistoryActivity.java
io.fabric.samples.cannonball.activity.PoemPopularActivity.java
io.fabric.samples.cannonball.activity.ThemeChooserActivity.java
io.fabric.samples.cannonball.db.DbHelper.java
io.fabric.samples.cannonball.db.PoemContract.java
io.fabric.samples.cannonball.db.PoemProvider.java
io.fabric.samples.cannonball.model.ThemeDrawables.java
io.fabric.samples.cannonball.model.Theme.java
io.fabric.samples.cannonball.model.WordBank.java
io.fabric.samples.cannonball.view.AvenirTextView.java
io.fabric.samples.cannonball.view.CannonballDigitsAuthButton.java
io.fabric.samples.cannonball.view.CannonballTwitterLoginButton.java
io.fabric.samples.cannonball.view.CountdownView.java
io.fabric.samples.cannonball.view.FlowLayout.java
io.fabric.samples.cannonball.view.ImageAdapter.java
io.fabric.samples.cannonball.view.ImageLoader.java
io.fabric.samples.cannonball.view.ThemeAdapter.java