Search in sources :

Example 6 with AttributionIdentifiers

use of com.facebook.internal.AttributionIdentifiers in project phonegap-facebook-plugin by Wizcorp.

the class AppEventsLogger method getSessionEventsState.

// Creates a new SessionEventsState if not already in the map.
private static SessionEventsState getSessionEventsState(Context context, AccessTokenAppIdPair accessTokenAppId) {
    // Do this work outside of the lock to prevent deadlocks in implementation of
    //  AdvertisingIdClient.getAdvertisingIdInfo, because that implementation blocks waiting on the main thread,
    //  which may also grab this staticLock.
    SessionEventsState state = stateMap.get(accessTokenAppId);
    AttributionIdentifiers attributionIdentifiers = null;
    if (state == null) {
        // Retrieve attributionId, but we will only send it if attribution is supported for the app.
        attributionIdentifiers = AttributionIdentifiers.getAttributionIdentifiers(context);
    }
    synchronized (staticLock) {
        // Check state again while we're locked.
        state = stateMap.get(accessTokenAppId);
        if (state == null) {
            state = new SessionEventsState(attributionIdentifiers, context.getPackageName(), hashedDeviceAndAppId);
            stateMap.put(accessTokenAppId, state);
        }
        return state;
    }
}
Also used : AttributionIdentifiers(com.facebook.internal.AttributionIdentifiers)

Aggregations

AttributionIdentifiers (com.facebook.internal.AttributionIdentifiers)6 JSONException (org.json.JSONException)4 JSONObject (org.json.JSONObject)4 SharedPreferences (android.content.SharedPreferences)3 GraphObject (com.facebook.model.GraphObject)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 Bundle (android.os.Bundle)1 FacebookException (com.facebook.FacebookException)1 GraphRequest (com.facebook.GraphRequest)1 JSONArray (org.json.JSONArray)1