Java 类com.facebook.internal.AttributionIdentifiers 实例源码
项目:BrillaMXAndroid
文件:AppEventsLogger.java
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(), getAnonymousAppDeviceGUID(context));
stateMap.put(accessTokenAppId, state);
}
return state;
}
}
项目:TP-Formation-Android
文件:AppEventsLogger.java
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;
}
}
项目:AutoTimeHelper
文件:AppEventsLogger.java
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;
}
}
项目:BrainStudio
文件:AppEventsLogger.java
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(), getAnonymousAppDeviceGUID(context));
stateMap.put(accessTokenAppId, state);
}
return state;
}
}
项目:Qtino.SharingKit
文件:AppEventsLogger.java
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;
}
}
项目:smartenit
文件:AppEventsLogger.java
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;
}
}
项目:DualRunner
文件:AppEventsLogger.java
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;
}
}
项目:MeNextAndroid
文件:AppEventsLogger.java
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;
}
}
项目:ClassParticipation2
文件:AppEventsLogger.java
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;
}
}
项目:PetTinder
文件:AppEventsLogger.java
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;
}
}
项目:StoryTeller
文件:AppEventsLogger.java
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;
}
}
项目:HereAStory-Android
文件:AppEventsLogger.java
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;
}
}
项目:Abelana-Android
文件:AppEventsLogger.java
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;
}
}
项目:localhost-android
文件:AppEventsLogger.java
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;
}
}
项目:facebook-api-android-maven
文件:AppEventsLogger.java
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;
}
}
项目:kognitivo
文件:AppEventsLogger.java
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(),
getAnonymousAppDeviceGUID(context));
stateMap.put(accessTokenAppId, state);
}
return state;
}
}
项目:kognitivo
文件:AppEventsLogger.java
public SessionEventsState(
AttributionIdentifiers identifiers,
String packageName,
String anonymousGUID) {
this.attributionIdentifiers = identifiers;
this.packageName = packageName;
this.anonymousAppDeviceGUID = anonymousGUID;
}
项目:Move-Alarm_ORCA
文件:AppEventsLogger.java
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(),
getAnonymousAppDeviceGUID(context));
stateMap.put(accessTokenAppId, state);
}
return state;
}
}
项目:Move-Alarm_ORCA
文件:AppEventsLogger.java
public SessionEventsState(
AttributionIdentifiers identifiers,
String packageName,
String anonymousGUID) {
this.attributionIdentifiers = identifiers;
this.packageName = packageName;
this.anonymousAppDeviceGUID = anonymousGUID;
}
项目:SocioBlood
文件:AppEventsLogger.java
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(),
getAnonymousAppDeviceGUID(context));
stateMap.put(accessTokenAppId, state);
}
return state;
}
}
项目:SocioBlood
文件:AppEventsLogger.java
public SessionEventsState(
AttributionIdentifiers identifiers,
String packageName,
String anonymousGUID) {
this.attributionIdentifiers = identifiers;
this.packageName = packageName;
this.anonymousAppDeviceGUID = anonymousGUID;
}
项目:QuizUpWinner
文件:Request.java
public static Request newCustomAudienceThirdPartyIdRequest(Session paramSession, Context paramContext, String paramString, Callback paramCallback)
{
if (paramSession == null)
paramSession = Session.getActiveSession();
if ((paramSession != null) && (!paramSession.isOpened()))
paramSession = null;
if (paramString == null)
if (paramSession != null)
paramString = paramSession.getApplicationId();
else
paramString = Utility.getMetadataApplicationId(paramContext);
if (paramString == null)
throw new FacebookException("Facebook App ID cannot be determined");
String str1 = paramString + "/custom_audience_third_party_id";
AttributionIdentifiers localAttributionIdentifiers = AttributionIdentifiers.getAttributionIdentifiers(paramContext);
Bundle localBundle = new Bundle();
if (paramSession == null)
{
String str2;
if (localAttributionIdentifiers.getAttributionId() != null)
str2 = localAttributionIdentifiers.getAttributionId();
else
str2 = localAttributionIdentifiers.getAndroidAdvertiserId();
if (localAttributionIdentifiers.getAttributionId() != null)
localBundle.putString("udid", str2);
}
if ((Settings.getLimitEventAndDataUsage(paramContext)) || (localAttributionIdentifiers.isTrackingLimited()))
localBundle.putString("limit_event_usage", "1");
HttpMethod localHttpMethod = HttpMethod.GET;
return new Request(paramSession, str1, localBundle, localHttpMethod, paramCallback);
}
项目:AndroidBackendlessChat
文件:Settings.java
static Response publishInstallAndWaitForResponse(
final Context context,
final String applicationId,
final boolean isAutoPublish) {
try {
if (context == null || applicationId == null) {
throw new IllegalArgumentException("Both context and applicationId must be non-null");
}
AttributionIdentifiers identifiers = AttributionIdentifiers.getAttributionIdentifiers(context);
SharedPreferences preferences = context.getSharedPreferences(ATTRIBUTION_PREFERENCES, Context.MODE_PRIVATE);
String pingKey = applicationId+"ping";
String jsonKey = applicationId+"json";
long lastPing = preferences.getLong(pingKey, 0);
String lastResponseJSON = preferences.getString(jsonKey, null);
// prevent auto publish from occurring if we have an explicit call.
if (!isAutoPublish) {
setShouldAutoPublishInstall(false);
}
GraphObject publishParams = GraphObject.Factory.create();
publishParams.setProperty(ANALYTICS_EVENT, MOBILE_INSTALL_EVENT);
Utility.setAppEventAttributionParameters(publishParams,
identifiers,
Utility.getHashedDeviceAndAppID(context, applicationId),
getLimitEventAndDataUsage(context));
publishParams.setProperty(AUTO_PUBLISH, isAutoPublish);
publishParams.setProperty("application_package_name", context.getPackageName());
String publishUrl = String.format(PUBLISH_ACTIVITY_PATH, applicationId);
Request publishRequest = Request.newPostRequest(null, publishUrl, publishParams, null);
if (lastPing != 0) {
GraphObject graphObject = null;
try {
if (lastResponseJSON != null) {
graphObject = GraphObject.Factory.create(new JSONObject(lastResponseJSON));
}
}
catch (JSONException je) {
// return the default graph object if there is any problem reading the data.
}
if (graphObject == null) {
return Response.createResponsesFromString("true", null, new RequestBatch(publishRequest), true).get(0);
} else {
return new Response(null, null, null, graphObject, true);
}
} else if (identifiers.getAndroidAdvertiserId() == null && identifiers.getAttributionId() == null) {
throw new FacebookException("No attribution id available to send to server.");
} else {
if (!Utility.queryAppSettings(applicationId, false).supportsAttribution()) {
throw new FacebookException("Install attribution has been disabled on the server.");
}
Response publishResponse = publishRequest.executeAndWait();
// denote success since no error threw from the post.
SharedPreferences.Editor editor = preferences.edit();
lastPing = System.currentTimeMillis();
editor.putLong(pingKey, lastPing);
// if we got an object response back, cache the string of the JSON.
if (publishResponse.getGraphObject() != null &&
publishResponse.getGraphObject().getInnerJSONObject() != null) {
editor.putString(jsonKey, publishResponse.getGraphObject().getInnerJSONObject().toString());
}
editor.commit();
return publishResponse;
}
} catch (Exception e) {
// if there was an error, fall through to the failure case.
Utility.logd("Facebook-publish", e);
return new Response(null, null, new FacebookRequestError(null, e));
}
}
项目:chat-sdk-android-push-firebase
文件:Settings.java
static Response publishInstallAndWaitForResponse(
final Context context,
final String applicationId,
final boolean isAutoPublish) {
try {
if (context == null || applicationId == null) {
throw new IllegalArgumentException("Both context and applicationId must be non-null");
}
AttributionIdentifiers identifiers = AttributionIdentifiers.getAttributionIdentifiers(context);
SharedPreferences preferences = context.getSharedPreferences(ATTRIBUTION_PREFERENCES, Context.MODE_PRIVATE);
String pingKey = applicationId+"ping";
String jsonKey = applicationId+"json";
long lastPing = preferences.getLong(pingKey, 0);
String lastResponseJSON = preferences.getString(jsonKey, null);
// prevent auto publish from occurring if we have an explicit call.
if (!isAutoPublish) {
setShouldAutoPublishInstall(false);
}
GraphObject publishParams = GraphObject.Factory.create();
publishParams.setProperty(ANALYTICS_EVENT, MOBILE_INSTALL_EVENT);
Utility.setAppEventAttributionParameters(publishParams,
identifiers,
Utility.getHashedDeviceAndAppID(context, applicationId),
getLimitEventAndDataUsage(context));
publishParams.setProperty(AUTO_PUBLISH, isAutoPublish);
publishParams.setProperty("application_package_name", context.getPackageName());
String publishUrl = String.format(PUBLISH_ACTIVITY_PATH, applicationId);
Request publishRequest = Request.newPostRequest(null, publishUrl, publishParams, null);
if (lastPing != 0) {
GraphObject graphObject = null;
try {
if (lastResponseJSON != null) {
graphObject = GraphObject.Factory.create(new JSONObject(lastResponseJSON));
}
}
catch (JSONException je) {
// return the default graph object if there is any problem reading the data.
}
if (graphObject == null) {
return Response.createResponsesFromString("true", null, new RequestBatch(publishRequest), true).get(0);
} else {
return new Response(null, null, null, graphObject, true);
}
} else if (identifiers.getAndroidAdvertiserId() == null && identifiers.getAttributionId() == null) {
throw new FacebookException("No attribution id available to send to server.");
} else {
if (!Utility.queryAppSettings(applicationId, false).supportsAttribution()) {
throw new FacebookException("Install attribution has been disabled on the server.");
}
Response publishResponse = publishRequest.executeAndWait();
// denote success since no error threw from the post.
SharedPreferences.Editor editor = preferences.edit();
lastPing = System.currentTimeMillis();
editor.putLong(pingKey, lastPing);
// if we got an object response back, cache the string of the JSON.
if (publishResponse.getGraphObject() != null &&
publishResponse.getGraphObject().getInnerJSONObject() != null) {
editor.putString(jsonKey, publishResponse.getGraphObject().getInnerJSONObject().toString());
}
editor.commit();
return publishResponse;
}
} catch (Exception e) {
// if there was an error, fall through to the failure case.
Utility.logd("Facebook-publish", e);
return new Response(null, null, new FacebookRequestError(null, e));
}
}
项目:BrillaMXAndroid
文件:AppEventsLogger.java
public SessionEventsState(AttributionIdentifiers identifiers, String packageName, String anonymousGUID) {
this.attributionIdentifiers = identifiers;
this.packageName = packageName;
this.anonymousAppDeviceGUID = anonymousGUID;
}
项目:BrillaMXAndroid
文件:Settings.java
static Response publishInstallAndWaitForResponse(
final Context context,
final String applicationId) {
try {
if (context == null || applicationId == null) {
throw new IllegalArgumentException("Both context and applicationId must be non-null");
}
AttributionIdentifiers identifiers = AttributionIdentifiers.getAttributionIdentifiers(context);
SharedPreferences preferences = context.getSharedPreferences(ATTRIBUTION_PREFERENCES, Context.MODE_PRIVATE);
String pingKey = applicationId+"ping";
String jsonKey = applicationId+"json";
long lastPing = preferences.getLong(pingKey, 0);
String lastResponseJSON = preferences.getString(jsonKey, null);
GraphObject publishParams = GraphObject.Factory.create();
publishParams.setProperty(ANALYTICS_EVENT, MOBILE_INSTALL_EVENT);
Utility.setAppEventAttributionParameters(
publishParams,
identifiers,
AppEventsLogger.getAnonymousAppDeviceGUID(context),
getLimitEventAndDataUsage(context));
publishParams.setProperty("application_package_name", context.getPackageName());
String publishUrl = String.format(PUBLISH_ACTIVITY_PATH, applicationId);
Request publishRequest = Request.newPostRequest(null, publishUrl, publishParams, null);
if (lastPing != 0) {
GraphObject graphObject = null;
try {
if (lastResponseJSON != null) {
graphObject = GraphObject.Factory.create(new JSONObject(lastResponseJSON));
}
}
catch (JSONException je) {
// return the default graph object if there is any problem reading the data.
}
if (graphObject == null) {
return Response.createResponsesFromString("true", null, new RequestBatch(publishRequest), true).get(0);
} else {
return new Response(null, null, null, graphObject, true);
}
} else {
Response publishResponse = publishRequest.executeAndWait();
// denote success since no error threw from the post.
SharedPreferences.Editor editor = preferences.edit();
lastPing = System.currentTimeMillis();
editor.putLong(pingKey, lastPing);
// if we got an object response back, cache the string of the JSON.
if (publishResponse.getGraphObject() != null &&
publishResponse.getGraphObject().getInnerJSONObject() != null) {
editor.putString(jsonKey, publishResponse.getGraphObject().getInnerJSONObject().toString());
}
editor.apply();
return publishResponse;
}
} catch (Exception e) {
// if there was an error, fall through to the failure case.
Utility.logd("Facebook-publish", e);
return new Response(null, null, new FacebookRequestError(null, e));
}
}
项目:TP-Formation-Android
文件:AppEventsLogger.java
public SessionEventsState(AttributionIdentifiers identifiers, String packageName, String hashedDeviceAndAppId) {
this.attributionIdentifiers = identifiers;
this.packageName = packageName;
this.hashedDeviceAndAppId = hashedDeviceAndAppId;
}
项目:TP-Formation-Android
文件:Settings.java
static Response publishInstallAndWaitForResponse(
final Context context,
final String applicationId,
final boolean isAutoPublish) {
try {
if (context == null || applicationId == null) {
throw new IllegalArgumentException("Both context and applicationId must be non-null");
}
AttributionIdentifiers identifiers = AttributionIdentifiers.getAttributionIdentifiers(context);
SharedPreferences preferences = context.getSharedPreferences(ATTRIBUTION_PREFERENCES, Context.MODE_PRIVATE);
String pingKey = applicationId+"ping";
String jsonKey = applicationId+"json";
long lastPing = preferences.getLong(pingKey, 0);
String lastResponseJSON = preferences.getString(jsonKey, null);
// prevent auto publish from occurring if we have an explicit call.
if (!isAutoPublish) {
setShouldAutoPublishInstall(false);
}
GraphObject publishParams = GraphObject.Factory.create();
publishParams.setProperty(ANALYTICS_EVENT, MOBILE_INSTALL_EVENT);
Utility.setAppEventAttributionParameters(publishParams,
identifiers,
Utility.getHashedDeviceAndAppID(context, applicationId),
getLimitEventAndDataUsage(context));
publishParams.setProperty(AUTO_PUBLISH, isAutoPublish);
publishParams.setProperty("application_package_name", context.getPackageName());
String publishUrl = String.format(PUBLISH_ACTIVITY_PATH, applicationId);
Request publishRequest = Request.newPostRequest(null, publishUrl, publishParams, null);
if (lastPing != 0) {
GraphObject graphObject = null;
try {
if (lastResponseJSON != null) {
graphObject = GraphObject.Factory.create(new JSONObject(lastResponseJSON));
}
}
catch (JSONException je) {
// return the default graph object if there is any problem reading the data.
}
if (graphObject == null) {
return Response.createResponsesFromString("true", null, new RequestBatch(publishRequest), true).get(0);
} else {
return new Response(null, null, null, graphObject, true);
}
} else if (identifiers == null ||
(identifiers.getAndroidAdvertiserId() == null && identifiers.getAttributionId() == null)) {
throw new FacebookException("No attribution id available to send to server.");
} else {
if (!Utility.queryAppSettings(applicationId, false).supportsAttribution()) {
throw new FacebookException("Install attribution has been disabled on the server.");
}
Response publishResponse = publishRequest.executeAndWait();
// denote success since no error threw from the post.
SharedPreferences.Editor editor = preferences.edit();
lastPing = System.currentTimeMillis();
editor.putLong(pingKey, lastPing);
// if we got an object response back, cache the string of the JSON.
if (publishResponse.getGraphObject() != null &&
publishResponse.getGraphObject().getInnerJSONObject() != null) {
editor.putString(jsonKey, publishResponse.getGraphObject().getInnerJSONObject().toString());
}
editor.apply();
return publishResponse;
}
} catch (Exception e) {
// if there was an error, fall through to the failure case.
Utility.logd("Facebook-publish", e);
return new Response(null, null, new FacebookRequestError(null, e));
}
}
项目:AutoTimeHelper
文件:AppEventsLogger.java
public SessionEventsState(AttributionIdentifiers identifiers, String packageName, String hashedDeviceAndAppId) {
this.attributionIdentifiers = identifiers;
this.packageName = packageName;
this.hashedDeviceAndAppId = hashedDeviceAndAppId;
}
项目:AutoTimeHelper
文件:Settings.java
static Response publishInstallAndWaitForResponse(
final Context context,
final String applicationId,
final boolean isAutoPublish) {
try {
if (context == null || applicationId == null) {
throw new IllegalArgumentException("Both context and applicationId must be non-null");
}
AttributionIdentifiers identifiers = AttributionIdentifiers.getAttributionIdentifiers(context);
SharedPreferences preferences = context.getSharedPreferences(ATTRIBUTION_PREFERENCES, Context.MODE_PRIVATE);
String pingKey = applicationId+"ping";
String jsonKey = applicationId+"json";
long lastPing = preferences.getLong(pingKey, 0);
String lastResponseJSON = preferences.getString(jsonKey, null);
// prevent auto publish from occurring if we have an explicit call.
if (!isAutoPublish) {
setShouldAutoPublishInstall(false);
}
GraphObject publishParams = GraphObject.Factory.create();
publishParams.setProperty(ANALYTICS_EVENT, MOBILE_INSTALL_EVENT);
Utility.setAppEventAttributionParameters(publishParams,
identifiers,
Utility.getHashedDeviceAndAppID(context, applicationId),
getLimitEventAndDataUsage(context));
publishParams.setProperty(AUTO_PUBLISH, isAutoPublish);
publishParams.setProperty("application_package_name", context.getPackageName());
String publishUrl = String.format(PUBLISH_ACTIVITY_PATH, applicationId);
Request publishRequest = Request.newPostRequest(null, publishUrl, publishParams, null);
if (lastPing != 0) {
GraphObject graphObject = null;
try {
if (lastResponseJSON != null) {
graphObject = GraphObject.Factory.create(new JSONObject(lastResponseJSON));
}
}
catch (JSONException je) {
// return the default graph object if there is any problem reading the data.
}
if (graphObject == null) {
return Response.createResponsesFromString("true", null, new RequestBatch(publishRequest), true).get(0);
} else {
return new Response(null, null, null, graphObject, true);
}
} else if (identifiers == null ||
(identifiers.getAndroidAdvertiserId() == null && identifiers.getAttributionId() == null)) {
throw new FacebookException("No attribution id available to send to server.");
} else {
if (!Utility.queryAppSettings(applicationId, false).supportsAttribution()) {
throw new FacebookException("Install attribution has been disabled on the server.");
}
Response publishResponse = publishRequest.executeAndWait();
// denote success since no error threw from the post.
SharedPreferences.Editor editor = preferences.edit();
lastPing = System.currentTimeMillis();
editor.putLong(pingKey, lastPing);
// if we got an object response back, cache the string of the JSON.
if (publishResponse.getGraphObject() != null &&
publishResponse.getGraphObject().getInnerJSONObject() != null) {
editor.putString(jsonKey, publishResponse.getGraphObject().getInnerJSONObject().toString());
}
editor.apply();
return publishResponse;
}
} catch (Exception e) {
// if there was an error, fall through to the failure case.
Utility.logd("Facebook-publish", e);
return new Response(null, null, new FacebookRequestError(null, e));
}
}
项目:snake-game-aws
文件:Settings.java
static Response publishInstallAndWaitForResponse(
final Context context,
final String applicationId,
final boolean isAutoPublish) {
try {
if (context == null || applicationId == null) {
throw new IllegalArgumentException("Both context and applicationId must be non-null");
}
AttributionIdentifiers identifiers = AttributionIdentifiers.getAttributionIdentifiers(context);
SharedPreferences preferences = context.getSharedPreferences(ATTRIBUTION_PREFERENCES, Context.MODE_PRIVATE);
String pingKey = applicationId+"ping";
String jsonKey = applicationId+"json";
long lastPing = preferences.getLong(pingKey, 0);
String lastResponseJSON = preferences.getString(jsonKey, null);
// prevent auto publish from occurring if we have an explicit call.
if (!isAutoPublish) {
setShouldAutoPublishInstall(false);
}
GraphObject publishParams = GraphObject.Factory.create();
publishParams.setProperty(ANALYTICS_EVENT, MOBILE_INSTALL_EVENT);
Utility.setAppEventAttributionParameters(publishParams,
identifiers,
Utility.getHashedDeviceAndAppID(context, applicationId),
getLimitEventAndDataUsage(context));
publishParams.setProperty(AUTO_PUBLISH, isAutoPublish);
publishParams.setProperty("application_package_name", context.getPackageName());
String publishUrl = String.format(PUBLISH_ACTIVITY_PATH, applicationId);
Request publishRequest = Request.newPostRequest(null, publishUrl, publishParams, null);
if (lastPing != 0) {
GraphObject graphObject = null;
try {
if (lastResponseJSON != null) {
graphObject = GraphObject.Factory.create(new JSONObject(lastResponseJSON));
}
}
catch (JSONException je) {
// return the default graph object if there is any problem reading the data.
}
if (graphObject == null) {
return Response.createResponsesFromString("true", null, new RequestBatch(publishRequest), true).get(0);
} else {
return new Response(null, null, null, graphObject, true);
}
} else if (identifiers.getAndroidAdvertiserId() == null && identifiers.getAttributionId() == null) {
throw new FacebookException("No attribution id available to send to server.");
} else {
if (!Utility.queryAppSettings(applicationId, false).supportsAttribution()) {
throw new FacebookException("Install attribution has been disabled on the server.");
}
Response publishResponse = publishRequest.executeAndWait();
// denote success since no error threw from the post.
SharedPreferences.Editor editor = preferences.edit();
lastPing = System.currentTimeMillis();
editor.putLong(pingKey, lastPing);
// if we got an object response back, cache the string of the JSON.
if (publishResponse.getGraphObject() != null &&
publishResponse.getGraphObject().getInnerJSONObject() != null) {
editor.putString(jsonKey, publishResponse.getGraphObject().getInnerJSONObject().toString());
}
editor.commit();
return publishResponse;
}
} catch (Exception e) {
// if there was an error, fall through to the failure case.
Utility.logd("Facebook-publish", e);
return new Response(null, null, new FacebookRequestError(null, e));
}
}
项目:BrainStudio
文件:AppEventsLogger.java
public SessionEventsState(AttributionIdentifiers identifiers, String packageName, String anonymousGUID) {
this.attributionIdentifiers = identifiers;
this.packageName = packageName;
this.anonymousAppDeviceGUID = anonymousGUID;
}
项目:BrainStudio
文件:Settings.java
static Response publishInstallAndWaitForResponse(
final Context context,
final String applicationId) {
try {
if (context == null || applicationId == null) {
throw new IllegalArgumentException("Both context and applicationId must be non-null");
}
AttributionIdentifiers identifiers = AttributionIdentifiers.getAttributionIdentifiers(context);
SharedPreferences preferences = context.getSharedPreferences(ATTRIBUTION_PREFERENCES, Context.MODE_PRIVATE);
String pingKey = applicationId+"ping";
String jsonKey = applicationId+"json";
long lastPing = preferences.getLong(pingKey, 0);
String lastResponseJSON = preferences.getString(jsonKey, null);
GraphObject publishParams = GraphObject.Factory.create();
publishParams.setProperty(ANALYTICS_EVENT, MOBILE_INSTALL_EVENT);
Utility.setAppEventAttributionParameters(
publishParams,
identifiers,
AppEventsLogger.getAnonymousAppDeviceGUID(context),
getLimitEventAndDataUsage(context));
publishParams.setProperty("application_package_name", context.getPackageName());
String publishUrl = String.format(PUBLISH_ACTIVITY_PATH, applicationId);
Request publishRequest = Request.newPostRequest(null, publishUrl, publishParams, null);
if (lastPing != 0) {
GraphObject graphObject = null;
try {
if (lastResponseJSON != null) {
graphObject = GraphObject.Factory.create(new JSONObject(lastResponseJSON));
}
}
catch (JSONException je) {
// return the default graph object if there is any problem reading the data.
}
if (graphObject == null) {
return Response.createResponsesFromString("true", null, new RequestBatch(publishRequest), true).get(0);
} else {
return new Response(null, null, null, graphObject, true);
}
} else {
Response publishResponse = publishRequest.executeAndWait();
// denote success since no error threw from the post.
SharedPreferences.Editor editor = preferences.edit();
lastPing = System.currentTimeMillis();
editor.putLong(pingKey, lastPing);
// if we got an object response back, cache the string of the JSON.
if (publishResponse.getGraphObject() != null &&
publishResponse.getGraphObject().getInnerJSONObject() != null) {
editor.putString(jsonKey, publishResponse.getGraphObject().getInnerJSONObject().toString());
}
editor.apply();
return publishResponse;
}
} catch (Exception e) {
// if there was an error, fall through to the failure case.
Utility.logd("Facebook-publish", e);
return new Response(null, null, new FacebookRequestError(null, e));
}
}
项目:Team-Alice
文件:Settings.java
static Response publishInstallAndWaitForResponse(
final Context context,
final String applicationId,
final boolean isAutoPublish) {
try {
if (context == null || applicationId == null) {
throw new IllegalArgumentException("Both context and applicationId must be non-null");
}
AttributionIdentifiers identifiers = AttributionIdentifiers.getAttributionIdentifiers(context);
SharedPreferences preferences = context.getSharedPreferences(ATTRIBUTION_PREFERENCES, Context.MODE_PRIVATE);
String pingKey = applicationId+"ping";
String jsonKey = applicationId+"json";
long lastPing = preferences.getLong(pingKey, 0);
String lastResponseJSON = preferences.getString(jsonKey, null);
// prevent auto publish from occurring if we have an explicit call.
if (!isAutoPublish) {
setShouldAutoPublishInstall(false);
}
GraphObject publishParams = GraphObject.Factory.create();
publishParams.setProperty(ANALYTICS_EVENT, MOBILE_INSTALL_EVENT);
Utility.setAppEventAttributionParameters(publishParams,
identifiers,
Utility.getHashedDeviceAndAppID(context, applicationId),
getLimitEventAndDataUsage(context));
publishParams.setProperty(AUTO_PUBLISH, isAutoPublish);
publishParams.setProperty("application_package_name", context.getPackageName());
String publishUrl = String.format(PUBLISH_ACTIVITY_PATH, applicationId);
Request publishRequest = Request.newPostRequest(null, publishUrl, publishParams, null);
if (lastPing != 0) {
GraphObject graphObject = null;
try {
if (lastResponseJSON != null) {
graphObject = GraphObject.Factory.create(new JSONObject(lastResponseJSON));
}
}
catch (JSONException je) {
// return the default graph object if there is any problem reading the data.
}
if (graphObject == null) {
return Response.createResponsesFromString("true", null, new RequestBatch(publishRequest), true).get(0);
} else {
return new Response(null, null, null, graphObject, true);
}
} else if (identifiers.getAndroidAdvertiserId() == null && identifiers.getAttributionId() == null) {
throw new FacebookException("No attribution id available to send to server.");
} else {
if (!Utility.queryAppSettings(applicationId, false).supportsAttribution()) {
throw new FacebookException("Install attribution has been disabled on the server.");
}
Response publishResponse = publishRequest.executeAndWait();
// denote success since no error threw from the post.
SharedPreferences.Editor editor = preferences.edit();
lastPing = System.currentTimeMillis();
editor.putLong(pingKey, lastPing);
// if we got an object response back, cache the string of the JSON.
if (publishResponse.getGraphObject() != null &&
publishResponse.getGraphObject().getInnerJSONObject() != null) {
editor.putString(jsonKey, publishResponse.getGraphObject().getInnerJSONObject().toString());
}
editor.commit();
return publishResponse;
}
} catch (Exception e) {
// if there was an error, fall through to the failure case.
Utility.logd("Facebook-publish", e);
return new Response(null, null, new FacebookRequestError(null, e));
}
}
项目:WatsiAndroidApp
文件:Settings.java
static Response publishInstallAndWaitForResponse(
final Context context,
final String applicationId,
final boolean isAutoPublish) {
try {
if (context == null || applicationId == null) {
throw new IllegalArgumentException("Both context and applicationId must be non-null");
}
AttributionIdentifiers identifiers = AttributionIdentifiers.getAttributionIdentifiers(context);
SharedPreferences preferences = context.getSharedPreferences(ATTRIBUTION_PREFERENCES, Context.MODE_PRIVATE);
String pingKey = applicationId+"ping";
String jsonKey = applicationId+"json";
long lastPing = preferences.getLong(pingKey, 0);
String lastResponseJSON = preferences.getString(jsonKey, null);
// prevent auto publish from occurring if we have an explicit call.
if (!isAutoPublish) {
setShouldAutoPublishInstall(false);
}
GraphObject publishParams = GraphObject.Factory.create();
publishParams.setProperty(ANALYTICS_EVENT, MOBILE_INSTALL_EVENT);
Utility.setAppEventAttributionParameters(publishParams,
identifiers,
Utility.getHashedDeviceAndAppID(context, applicationId),
getLimitEventAndDataUsage(context));
publishParams.setProperty(AUTO_PUBLISH, isAutoPublish);
publishParams.setProperty("application_package_name", context.getPackageName());
String publishUrl = String.format(PUBLISH_ACTIVITY_PATH, applicationId);
Request publishRequest = Request.newPostRequest(null, publishUrl, publishParams, null);
if (lastPing != 0) {
GraphObject graphObject = null;
try {
if (lastResponseJSON != null) {
graphObject = GraphObject.Factory.create(new JSONObject(lastResponseJSON));
}
}
catch (JSONException je) {
// return the default graph object if there is any problem reading the data.
}
if (graphObject == null) {
return Response.createResponsesFromString("true", null, new RequestBatch(publishRequest), true).get(0);
} else {
return new Response(null, null, null, graphObject, true);
}
} else if (identifiers.getAndroidAdvertiserId() == null && identifiers.getAttributionId() == null) {
throw new FacebookException("No attribution id available to send to server.");
} else {
if (!Utility.queryAppSettings(applicationId, false).supportsAttribution()) {
throw new FacebookException("Install attribution has been disabled on the server.");
}
Response publishResponse = publishRequest.executeAndWait();
// denote success since no error threw from the post.
SharedPreferences.Editor editor = preferences.edit();
lastPing = System.currentTimeMillis();
editor.putLong(pingKey, lastPing);
// if we got an object response back, cache the string of the JSON.
if (publishResponse.getGraphObject() != null &&
publishResponse.getGraphObject().getInnerJSONObject() != null) {
editor.putString(jsonKey, publishResponse.getGraphObject().getInnerJSONObject().toString());
}
editor.commit();
return publishResponse;
}
} catch (Exception e) {
// if there was an error, fall through to the failure case.
Utility.logd("Facebook-publish", e);
return new Response(null, null, new FacebookRequestError(null, e));
}
}
项目:Qtino.SharingKit
文件:AppEventsLogger.java
public SessionEventsState(AttributionIdentifiers identifiers, String packageName, String hashedDeviceAndAppId) {
this.attributionIdentifiers = identifiers;
this.packageName = packageName;
this.hashedDeviceAndAppId = hashedDeviceAndAppId;
}
项目:Qtino.SharingKit
文件:Settings.java
static Response publishInstallAndWaitForResponse(
final Context context,
final String applicationId,
final boolean isAutoPublish) {
try {
if (context == null || applicationId == null) {
throw new IllegalArgumentException("Both context and applicationId must be non-null");
}
AttributionIdentifiers identifiers = AttributionIdentifiers.getAttributionIdentifiers(context);
SharedPreferences preferences = context.getSharedPreferences(ATTRIBUTION_PREFERENCES, Context.MODE_PRIVATE);
String pingKey = applicationId+"ping";
String jsonKey = applicationId+"json";
long lastPing = preferences.getLong(pingKey, 0);
String lastResponseJSON = preferences.getString(jsonKey, null);
// prevent auto publish from occurring if we have an explicit call.
if (!isAutoPublish) {
setShouldAutoPublishInstall(false);
}
GraphObject publishParams = GraphObject.Factory.create();
publishParams.setProperty(ANALYTICS_EVENT, MOBILE_INSTALL_EVENT);
Utility.setAppEventAttributionParameters(publishParams,
identifiers,
Utility.getHashedDeviceAndAppID(context, applicationId),
getLimitEventAndDataUsage(context));
publishParams.setProperty(AUTO_PUBLISH, isAutoPublish);
publishParams.setProperty("application_package_name", context.getPackageName());
String publishUrl = String.format(PUBLISH_ACTIVITY_PATH, applicationId);
Request publishRequest = Request.newPostRequest(null, publishUrl, publishParams, null);
if (lastPing != 0) {
GraphObject graphObject = null;
try {
if (lastResponseJSON != null) {
graphObject = GraphObject.Factory.create(new JSONObject(lastResponseJSON));
}
}
catch (JSONException je) {
// return the default graph object if there is any problem reading the data.
}
if (graphObject == null) {
return Response.createResponsesFromString("true", null, new RequestBatch(publishRequest), true).get(0);
} else {
return new Response(null, null, null, graphObject, true);
}
} else if (identifiers == null ||
(identifiers.getAndroidAdvertiserId() == null && identifiers.getAttributionId() == null)) {
throw new FacebookException("No attribution id available to send to server.");
} else {
if (!Utility.queryAppSettings(applicationId, false).supportsAttribution()) {
throw new FacebookException("Install attribution has been disabled on the server.");
}
Response publishResponse = publishRequest.executeAndWait();
// denote success since no error threw from the post.
SharedPreferences.Editor editor = preferences.edit();
lastPing = System.currentTimeMillis();
editor.putLong(pingKey, lastPing);
// if we got an object response back, cache the string of the JSON.
if (publishResponse.getGraphObject() != null &&
publishResponse.getGraphObject().getInnerJSONObject() != null) {
editor.putString(jsonKey, publishResponse.getGraphObject().getInnerJSONObject().toString());
}
editor.commit();
return publishResponse;
}
} catch (Exception e) {
// if there was an error, fall through to the failure case.
Utility.logd("Facebook-publish", e);
return new Response(null, null, new FacebookRequestError(null, e));
}
}
项目:smartenit
文件:AppEventsLogger.java
public SessionEventsState(AttributionIdentifiers identifiers, String packageName, String hashedDeviceAndAppId) {
this.attributionIdentifiers = identifiers;
this.packageName = packageName;
this.hashedDeviceAndAppId = hashedDeviceAndAppId;
}
项目:smartenit
文件:Settings.java
static Response publishInstallAndWaitForResponse(
final Context context,
final String applicationId,
final boolean isAutoPublish) {
try {
if (context == null || applicationId == null) {
throw new IllegalArgumentException("Both context and applicationId must be non-null");
}
AttributionIdentifiers identifiers = AttributionIdentifiers.getAttributionIdentifiers(context);
SharedPreferences preferences = context.getSharedPreferences(ATTRIBUTION_PREFERENCES, Context.MODE_PRIVATE);
String pingKey = applicationId+"ping";
String jsonKey = applicationId+"json";
long lastPing = preferences.getLong(pingKey, 0);
String lastResponseJSON = preferences.getString(jsonKey, null);
// prevent auto publish from occurring if we have an explicit call.
if (!isAutoPublish) {
setShouldAutoPublishInstall(false);
}
GraphObject publishParams = GraphObject.Factory.create();
publishParams.setProperty(ANALYTICS_EVENT, MOBILE_INSTALL_EVENT);
Utility.setAppEventAttributionParameters(publishParams,
identifiers,
Utility.getHashedDeviceAndAppID(context, applicationId),
getLimitEventAndDataUsage(context));
publishParams.setProperty(AUTO_PUBLISH, isAutoPublish);
publishParams.setProperty("application_package_name", context.getPackageName());
String publishUrl = String.format(PUBLISH_ACTIVITY_PATH, applicationId);
Request publishRequest = Request.newPostRequest(null, publishUrl, publishParams, null);
if (lastPing != 0) {
GraphObject graphObject = null;
try {
if (lastResponseJSON != null) {
graphObject = GraphObject.Factory.create(new JSONObject(lastResponseJSON));
}
}
catch (JSONException je) {
// return the default graph object if there is any problem reading the data.
}
if (graphObject == null) {
return Response.createResponsesFromString("true", null, new RequestBatch(publishRequest), true).get(0);
} else {
return new Response(null, null, null, graphObject, true);
}
} else if (identifiers == null ||
(identifiers.getAndroidAdvertiserId() == null && identifiers.getAttributionId() == null)) {
throw new FacebookException("No attribution id available to send to server.");
} else {
if (!Utility.queryAppSettings(applicationId, false).supportsAttribution()) {
throw new FacebookException("Install attribution has been disabled on the server.");
}
Response publishResponse = publishRequest.executeAndWait();
// denote success since no error threw from the post.
SharedPreferences.Editor editor = preferences.edit();
lastPing = System.currentTimeMillis();
editor.putLong(pingKey, lastPing);
// if we got an object response back, cache the string of the JSON.
if (publishResponse.getGraphObject() != null &&
publishResponse.getGraphObject().getInnerJSONObject() != null) {
editor.putString(jsonKey, publishResponse.getGraphObject().getInnerJSONObject().toString());
}
editor.commit();
return publishResponse;
}
} catch (Exception e) {
// if there was an error, fall through to the failure case.
Utility.logd("Facebook-publish", e);
return new Response(null, null, new FacebookRequestError(null, e));
}
}
项目:DualRunner
文件:AppEventsLogger.java
public SessionEventsState(AttributionIdentifiers identifiers, String packageName, String hashedDeviceAndAppId) {
this.attributionIdentifiers = identifiers;
this.packageName = packageName;
this.hashedDeviceAndAppId = hashedDeviceAndAppId;
}