本文整理匯總了Java中com.parse.ParseAnalytics類的典型用法代碼示例。如果您正苦於以下問題:Java ParseAnalytics類的具體用法?Java ParseAnalytics怎麽用?Java ParseAnalytics使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ParseAnalytics類屬於com.parse包,在下文中一共展示了ParseAnalytics類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: start
import com.parse.ParseAnalytics; //導入依賴的package包/類
@Kroll.method
public void start()
{
setState(STATE_RUNNING);
// App opens analytics
ParseAnalytics.trackAppOpenedInBackground(TiApplication.getAppRootOrCurrentActivity().getIntent());
ParseInstallation.getCurrentInstallation().put("androidId", getAndroidId());
ParseInstallation.getCurrentInstallation().saveInBackground(new SaveCallback() {
public void done(ParseException e) {
if (e != null) {
Log.e(TAG, "Installation initialization failed: " + e.getMessage());
}
// fire event
try {
JSONObject pnData = new JSONObject();
pnData.put("objectId", getObjectId());
pnData.put("installationId", getCurrentInstallationId());
KrollDict data = new KrollDict(pnData);
module.fireEvent("installationId", data);
} catch (JSONException e1) {
Log.e(TAG, "InstallationId event failed: " + e1.getMessage());
}
}
});
}
示例2: onCreate
import com.parse.ParseAnalytics; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ParseAnalytics.trackAppOpenedInBackground(getIntent());
toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
// Find our drawer view
mDrawer = (DrawerLayout) findViewById(R.id.drawer_layout);
drawerToggle = setupDrawerToggle();
// Tie DrawerLayout events to the ActionBarToggle
mDrawer.setDrawerListener(drawerToggle);
// Find our drawer view
nvDrawer = (NavigationView) findViewById(R.id.nvView);
// Setup drawer view
setupDrawerContent(nvDrawer);
}
示例3: EnablePush
import com.parse.ParseAnalytics; //導入依賴的package包/類
public static void EnablePush(TiApplication app) {
Context appContext = app.getApplicationContext();
Activity appActivity = app.getAppCurrentActivity();
if (appContext == null) {
Log.e(TAG, "Application context is null, can't initialize Parse");
return;
}
else if (appActivity == null) {
Log.e(TAG, "Application activity is null, can't initialize Parse");
return;
}
else {
//PushService.setDefaultPushCallback(appContext, appActivity.getClass());
ParseAnalytics.trackAppOpened(appActivity.getIntent());
ParseInstallation.getCurrentInstallation().saveInBackground();
}
}
示例4: onStop
import com.parse.ParseAnalytics; //導入依賴的package包/類
@Override
protected void onStop() {
super.onStop();
((App) getApplication()).getGoogleApiClient().disconnect();
Map<String, String> params = new HashMap<>();
//
// params.put("total time", timeFormat((System.currentTimeMillis()-activityStartTime)/1000));
// ParseAnalytics.trackEventInBackground("application close", params);
long timeElapsed = System.nanoTime() - activityStartTime;
timeElapsed = timeElapsed / 1000000000;//Convert to seconds;
params.put("spent/min", String.valueOf((timeElapsed / 60)));
params.put("spent/sec", String.valueOf((timeElapsed % 60)));
ParseAnalytics.trackEventInBackground("mainactivity/close", params);
}
示例5: onBindViewHolder
import com.parse.ParseAnalytics; //導入依賴的package包/類
@Override
public void onBindViewHolder(final ViewHolder viewHolder, final int i) {
viewHolder.offerName.setText(offerList.get(i).getTitle());
viewHolder.availability.setText(offerList.get(i).getAvailability());
viewHolder.offerDescription.setText(offerList.get(i).getDescription());
// if(Boolean.valueOf(searchList.get(i).getCodAvailable()))
// viewHolder.cod.setText("COD Available : Yes");
// else
// viewHolder.cod.setText("COD Available : No");
Picasso.with(getActivity()).load(offerList.get(i).getImageUrls().get(0).getUrl()).fit().centerCrop().into(viewHolder.icon);
viewHolder.view.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Map<String, String> params = new HashMap<>();
params.put("success", "true");
params.put("offer name clicked", offerList.get(i).getTitle());
ParseAnalytics.trackEventInBackground("shopping/search clicked", params);
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(offerList.get(i).getUrl()));
startActivity(browserIntent);
}
});
}
示例6: onCreate
import com.parse.ParseAnalytics; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
loginButton = (Button) findViewById(R.id.loginButton);
loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.i(AnypicApplication.TAG, "Login button clicked");
onLoginButtonClicked();
}
});
// Check if there is a currently logged in user
// and they are linked to a Facebook account.
ParseUser currentUser = ParseUser.getCurrentUser();
if ((currentUser != null) && ParseFacebookUtils.isLinked(currentUser)) {
// Go to the main photo list view activity
showHomeListActivity();
}
// For push notifications
ParseAnalytics.trackAppOpened(getIntent());
}
示例7: parseBootstrap
import com.parse.ParseAnalytics; //導入依賴的package包/類
private void parseBootstrap() {
try {
Thread.sleep(3000);
} catch(InterruptedException ex) {
Thread.currentThread().interrupt();
}
ParseAnalytics.trackAppOpenedInBackground(getIntent());
Parse.setLogLevel(Parse.LOG_LEVEL_DEBUG);
for (int i = 0; i < 1; i++) {
System.out.print("XXX wrinting" + i);
ParseObject testObject = new ParseObject("TestObject");
testObject.put("foo", "bar");
testObject.saveInBackground();
}
Map<String, String> dimensions = new HashMap<String, String>();
// What type of news is this?
dimensions.put("category", "politics");
// Is it a weekday or the weekend?
dimensions.put("dayType", "weekday");
// Send the dimensions to Parse along with the 'read' event
ParseAnalytics.trackEventInBackground("read", dimensions);
}
示例8: onPushOpen
import com.parse.ParseAnalytics; //導入依賴的package包/類
@Override
protected void onPushOpen(Context context, Intent intent) {
// Send a Parse Analytics "push opened" event
ParseAnalytics.trackAppOpenedInBackground(intent);
String psPostId = null;
try {
JSONObject pushData = new JSONObject(intent.getStringExtra(KEY_PUSH_DATA));
psPostId = pushData.optString(PUSH_POST_ID_EXTRA, null);
} catch (JSONException e) {
e.printStackTrace();
}
Intent activityIntent = new Intent(context, ActivityMain.class);
activityIntent.putExtra(PUSH_POST_ID_EXTRA, psPostId);
activityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
context.startActivity(activityIntent);
}
示例9: onCreate
import com.parse.ParseAnalytics; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ParseAnalytics.trackAppOpened(getIntent());
mFacebookButton = (Button) findViewById(R.id.facebook);
mFacebookButton.setOnClickListener(this);
mSignUpButton = (Button) findViewById(R.id.signup);
mSignUpButton.setOnClickListener(this);
mLoginButton = (Button) findViewById(R.id.login);
mLoginButton.setOnClickListener(this);
if (ParseUser.getCurrentUser() != null) {
showInboxActivity();
finish();
}
}
示例10: onCreate
import com.parse.ParseAnalytics; //導入依賴的package包/類
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.registerpage);
EditText passwordField = (EditText) findViewById(R.id.registerPassword2);
passwordField.setOnKeyListener(new OnKeyListener()
{
public boolean onKey(View v, int keyCode, KeyEvent event)
{
if (event.getAction() == KeyEvent.ACTION_DOWN)
{
switch (keyCode)
{
case KeyEvent.KEYCODE_DPAD_CENTER:
case KeyEvent.KEYCODE_ENTER:
registerButtonClicked(v);
return true;
default:
break;
}
}
return false;
}
});
ParseAnalytics.trackAppOpened(getIntent());
}
示例11: onCreate
import com.parse.ParseAnalytics; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
ParseAnalytics.trackAppOpenedInBackground(getIntent());
}
示例12: onPushOpen
import com.parse.ParseAnalytics; //導入依賴的package包/類
@Override
public void onPushOpen(Context context, Intent intent) {
Intent i = context.getPackageManager().getLaunchIntentForPackage(context.getApplicationContext().getPackageName());
// Push open analytics
ParseAnalytics.trackAppOpenedInBackground(intent);
/* Check if the app is running or in background. If not, just start the app and add the
* notification as Extra */
if (ParseModule.getInstance() == null || ParseModule.getInstance().getState() == ParseModule.STATE_DESTROYED) {
Log.d("onPushOpen", "App was killed; resume the app without triggering 'notificationopen'");
i.putExtras(intent.getExtras());
context.startActivity(i);
return;
}
/* Otherwise, just resume the app if necessary, and trigger the event */
try {
KrollDict data = new KrollDict(new JSONObject(intent.getExtras().getString("com.parse.Data")));
if (ParseModule.getInstance().getState() != ParseModule.STATE_RUNNING) {
Log.d("onPushOpen", "App was in background; resume the app and trigger 'notificationopen'");
context.startActivity(i);
} else {
Log.d("onPushOpen", "App is running in foreground; trigger 'notificationopen'");
}
ParseModule.getInstance().fireEvent("notificationopen", data);
} catch (Exception e) {
Log.d("onPushOpen", e.getMessage());
}
}
示例13: onPushOpen
import com.parse.ParseAnalytics; //導入依賴的package包/類
@Override
protected void onPushOpen(Context context, Intent intent) {
ParseAnalytics.trackAppOpenedInBackground(intent);
FirebaseAnalytics.getInstance(context).logEvent(Constants.EVENT_NOTIFICATION_OPEN,
new Bundle());
Intent activityIntent = MainActivity.getNewIntent(context);
activityIntent.putExtras(intent.getExtras());
context.startActivity(activityIntent);
}
示例14: onCreate
import com.parse.ParseAnalytics; //導入依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
ParseAnalytics.trackAppOpenedInBackground(getIntent());
}
示例15: onPushOpen
import com.parse.ParseAnalytics; //導入依賴的package包/類
protected void onPushOpen(Context context, Intent intent) {
// Send a Parse Analytics "push opened" event
ParseAnalytics.trackAppOpenedInBackground(intent);
String uriString = null;
String eventObjectId = null;
try {
JSONObject pushData = new JSONObject(intent.getStringExtra(KEY_PUSH_DATA));
uriString = pushData.optString("uri", null);
eventObjectId = pushData.optString("eventObjectId", null);
} catch (JSONException e) {
Timber.e("Unexpected JSONException when receiving push data: " + e);
}
Class<? extends Activity> cls = getActivity(context, intent);
Intent activityIntent;
if (uriString != null) {
activityIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(uriString));
} else if(!TextUtils.isEmpty(eventObjectId)) {
activityIntent = new Intent(EventDetailActivity.newIntent(context, eventObjectId));
} else {
activityIntent = new Intent(context, cls);
}
activityIntent.putExtras(intent.getExtras());
/*
In order to remove dependency on android-support-library-v4
The reason why we differentiate between versions instead of just using context.startActivity
for all devices is because in API 11 the recommended conventions for app navigation using
the back key changed.
*/
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
TaskStackBuilderHelper.startActivities(context, cls, activityIntent);
} else {
activityIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
activityIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
context.startActivity(activityIntent);
}
}