@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()); } } }); }
@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); }
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(); } }
@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); }
@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); } }); }
@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()); }
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); }
@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); }
@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(); } }
/** 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()); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ParseAnalytics.trackAppOpenedInBackground(getIntent()); }
@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()); } }
@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); }
@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()); }
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); } }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //anonymously track this app opening ParseAnalytics.trackAppOpenedInBackground(getIntent()); final SharedPreferences sharedPref = getSharedPreferences(getString(R.string.preference_file_key), MODE_PRIVATE); mProvince = sharedPref.getString(getString(R.string.province), "British Columbia"); TextView fedNameText = (TextView)findViewById(R.id.federalNameMain); fedNameText.setText(sharedPref.getString(getString(R.string.federal_name), "")); TextView provNameText = (TextView)findViewById(R.id.provincialNameMain); provNameText.setText(sharedPref.getString(getString(R.string.provincial_name), "")); TextView muniContactsText = (TextView)findViewById(R.id.municipalMain); //list of all contacts which is stored in SharedPreferences. Yeah, I'm awesome at Android... //convert list to actual contacts here. We should always have current list in municipal_contacts. String contactString = sharedPref.getString("saved_muni_contacts", ""); if(!contactString.isEmpty()){ municipal_contacts = Contact.convertStringToContacts(contactString); } else{ municipal_contacts = new ArrayList<>(); } numMunicipalContacts = municipal_contacts.size(); if(numMunicipalContacts == 1) muniContactsText.setText(numMunicipalContacts + " Contact"); else muniContactsText.setText(numMunicipalContacts + " Contacts"); setupPhoneButtons(sharedPref); setupEmailButtons(sharedPref); setupBottomButtons(sharedPref); }
@Override protected void onStart() { super.onStart(); ((App) getApplication()).getGoogleApiClient().connect(); Map<String, String> params = new HashMap<>(); activityStartTime = System.nanoTime(); params.put("device/brand", Build.BRAND); params.put("device/model", Build.MODEL); ParseAnalytics.trackEventInBackground("mainactivity/open", params); }
private void loginSuccess() { analyticsParams.put("success", "true"); ParseAnalytics.trackEventInBackground("login", analyticsParams); Intent intent = new Intent(this, MainActivity.class); startActivity(intent); finish(); }
@Override public void onBindViewHolder(final ViewHolder viewHolder, final int i) { viewHolder.productName.setText(searchList.get(i).getMainTitle()); viewHolder.minPrice.setText("\u20b9" + searchList.get(i).getSellingPrice()); viewHolder.mrp.setText("\u20b9 " + searchList.get(i).getMrp()); viewHolder.mrp.setPaintFlags(viewHolder.mrp.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG); if (searchList.get(i).getSubTitle() != null) viewHolder.productDescription.setText(searchList.get(i).getSubTitle()); viewHolder.cod.setText("COD Available : Yes"); Picasso.with(getActivity()).load(searchList.get(i).getProductAltImage()).fit().centerInside().into(viewHolder.icon); // Log.d("IMAGE URL : ", searchList.get(i).getImageUrls().get_400x400()); viewHolder.view.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Map<String, String> params = new HashMap<>(); params.put("success", "true"); params.put("product name clicked", searchList.get(i).getMainTitle()); ParseAnalytics.trackEventInBackground("shopping/search clicked", params); Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(searchList.get(i).getSmartUrl() + "&affid=arnavgrep")); startActivity(browserIntent); } }); }
private void sendParseAnalytics(String success) { Map<String, String> params = new HashMap<>(); params.put("lat", String.valueOf(App.currentLatitude)); params.put("lng", String.valueOf(App.currentLongitude)); params.put("success", success); ParseAnalytics.trackEventInBackground("food/orders/search", params); }
private void sendParseAnalytics(String success) { Map<String, String> params = new HashMap<>(); params.put("departure", departureLocation); params.put("arrival", arrivalLocation); params.put("travelDate", travelDate); params.put("numberOfAdults", numOfAdults); params.put("success", success); ParseAnalytics.trackEventInBackground("travel/flight/search", params); }
private void sendParseAnalytics(String success) { Map<String, String> params = new HashMap<>(); params.put("lat", String.valueOf(App.currentLatitude)); params.put("lng", String.valueOf(App.currentLongitude)); params.put("success", success); ParseAnalytics.trackEventInBackground("travel/cabs/search", params); }
private void sendParseAnalytics(String success) { Map<String, String> params = new HashMap<>(); params.put("departure", departureLocation); params.put("arrival", arrivalLocation); params.put("travelDate", travelDate); params.put("success", success); ParseAnalytics.trackEventInBackground("travel/bus/search", params); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); // Track app opens. ParseAnalytics.trackAppOpened(getIntent()); // Set up our UI member properties. this.genderFemaleButton = (RadioButton) findViewById(R.id.gender_female_button); this.genderMaleButton = (RadioButton) findViewById(R.id.gender_male_button); this.ageEditText = (EditText) findViewById(R.id.age_edit_text); this.genderRadioGroup = (RadioGroup) findViewById(R.id.gender_radio_group); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); ParseAnalytics.trackAppOpenedInBackground(getIntent()); Intent intent = new Intent(MainActivity.this, LoginActivity.class); startActivity(intent); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mPrefs = new PreferenceHandler(this); ParseAnalytics.trackAppOpened(getIntent()); // Only enable Crashlytics if opted in and manifest key isn't our placeholder if (mPrefs.getCROptIn() && hasCrashlyticsApiKey(this)) { Crashlytics.start(this); } // Set up our views setContentView(R.layout.activity_main); getSupportActionBar().setLogo(getResources().getDrawable(R.drawable.surewalkbanner)); getSupportActionBar().setDisplayUseLogoEnabled(true); getSupportActionBar().setDisplayShowTitleEnabled(false); // Set up our fragments. In this case we just have one: DashboardFragment if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction().add(R.id.container, DashboardFragment.newInstance("Home")); } // If it's their first time running the app, show a dialog to set up info if (!mPrefs.getFirstRun()) { mPrefs.setFirstRun(); firstRunDialog(); } // Check if keys are real or our dummies // may be worthwhile to comment this out during testing if (!mPrefs.getKeyCheck()) { checkKeys(); } }
/** Called when the activity is first created. */ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ParseAnalytics.trackAppOpened(getIntent()); vpPager = (ViewPager) findViewById(R.id.viewPager); adapterViewPager = new PatientsPagerAdapter(getSupportFragmentManager()); vpPager.setAdapter(adapterViewPager); setupSlidingTabs(vpPager); }
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_mentor_list); setCurrentLocation(); ParseAnalytics.trackAppOpened(getIntent()); if (savedInstanceState == null) { // If there is no saved instance state, add a fragment representing the // front of the card to this activity. If there is saved instance state, // this fragment will have already been added to the activity. getFragmentManager() .beginTransaction() .add(R.id.rlContainer, sListFragment) .commit(); } else { mShowingBack = (getFragmentManager().getBackStackEntryCount() > 0); } Async.dispatchMain(new Runnable() { @Override public void run() { populateListView(); } }); enableDrawer((DrawerLayout) findViewById(R.id.drawer_layout)); getFragmentManager().addOnBackStackChangedListener(this); NotificationCenter.registerListener(this, User.NOTIFICATION_ME); }
/** Called when the activity is first created. */ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.mainpage); getEvents(); ParseAnalytics.trackAppOpened(getIntent()); }
public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.friendsearch); ParseAnalytics.trackAppOpened(getIntent()); listFriends(searchFriend(FriendPage.searchQuery)); //* *EDIT* * ListView listview = (ListView) findViewById(R.id.listView); listview.setOnItemClickListener(this); }
/** * Signals 'app opened' intent to 3rd-part analytics systems. * @param intent - intent used to open app */ public static void trackAppOpened(android.content.Intent intent) { if (app==null) { Log.e(TAG,"trackAppOpened: app is null"); return; } //don't track anything if this is disabled on global level if (MyApplication.isAnalyticsEnabled()) { Log.d(TAG,"Sending intent "+intent.toString()+" to analytics service"); ParseAnalytics.trackAppOpened(intent); Map<String, String> dimensions = new HashMap<String, String>(); dimensions.put("intent",intent.toString()); if (intent.getAction()!=null) { dimensions.put("action",intent.getAction()); } if (intent.getPackage()!=null) { dimensions.put("package",intent.getPackage()); } if (intent.getType()!=null) { dimensions.put("type",intent.getType()); } //TODO:send APP_OPENED event with thos dimensions to Mixpanel } else { Log.d(TAG, "trackAppOpened not sending intent " + intent.toString() + " to analytics service"); } }
/** * Signals event to be recorded by 3rd-party analytics systems. * @param name - event name * @param dimensions - additional event information */ public static void trackEvent(String name, java.util.Map<java.lang.String,java.lang.String> dimensions) { if (app==null) { Log.e(TAG,"trackEvent (with dimensions): app is null"); return; } //don't track anything if this is disabled on global level if (MyApplication.isAnalyticsEnabled()) { Log.d(TAG,"Sending event "+name+" (with dimensions) to analytics service"); try { ParseAnalytics.trackEvent(name,dimensions); MixpanelAPI mixpanel = MixpanelAPI.getInstance(storedContext,BuildConfig.MIXPANEL_TOKEN); JSONObject props = new JSONObject(); //convert to mixpanel's format for (Map.Entry<String, String> entry : dimensions.entrySet()) { props.put(entry.getKey(),entry.getValue()); } mixpanel.track(name, props); } catch (Exception ex) { Log.d(TAG,"Failed to log event due to exception:"+ex.toString()); ex.printStackTrace(); } } else { Log.d(TAG,"trackEvent not sending event " + name + " (with dimensions) to analytics service"); } }
@Override public void onIssueDownloadClicked(Issue issue) { Map<String, String> dimensions = new HashMap<>(); dimensions.put("Title", issue.getTitle()); dimensions.put("Paid", issue.hasPrice() ? "yes" : "no"); dimensions.put("Purchased", issue.isPurchased() ? "yes" : "no"); ParseAnalytics.trackEventInBackground("Download_Issue_Clicked", dimensions); }
@Override public void onIssueArchiveClicked(Issue issue) { Map<String, String> dimensions = new HashMap<>(); dimensions.put("Title", issue.getTitle()); dimensions.put("Paid", issue.hasPrice() ? "yes" : "no"); dimensions.put("Purchased", issue.isPurchased() ? "yes" : "no"); ParseAnalytics.trackEventInBackground("Archive_Issue_Clicked", dimensions); }
@Override public void onIssueReadClicked(Issue issue) { Map<String, String> dimensions = new HashMap<>(); dimensions.put("Title", issue.getTitle()); dimensions.put("Paid", issue.hasPrice() ? "yes" : "no"); dimensions.put("Purchased", issue.isPurchased() ? "yes" : "no"); ParseAnalytics.trackEventInBackground("Read_Issue_Clicked", dimensions); }
public void onIssuePageOpened(Issue issue, String pageTitle, int pageIndex) { Map<String, String> dimensions = new HashMap<>(); dimensions.put("Issue Title", issue.getTitle()); dimensions.put("Page Title", pageTitle); dimensions.put("Page Index", String.valueOf(pageIndex)); ParseAnalytics.trackEventInBackground("View_Issue_Page", dimensions); }
@Override public void onIssuePurchaseClicked(Issue issue) { Map<String, String> dimensions = new HashMap<>(); dimensions.put("Title", issue.getTitle()); dimensions.put("Paid", issue.hasPrice() ? "yes" : "no"); dimensions.put("Purchased", issue.isPurchased() ? "yes" : "no"); dimensions.put("Price", issue.getPrice()); ParseAnalytics.trackEventInBackground("Purchase_Issue_Clicked", dimensions); }
@Override public void onSubscribeClicked(Sku subscription) { Map<String, String> dimensions = new HashMap<>(); dimensions.put("Title", subscription.title); dimensions.put("Id", subscription.id); dimensions.put("Price", subscription.price); ParseAnalytics.trackEventInBackground("Subscribe_Clicked", dimensions); }
public void onIssuePageOpened(Issue issue, String pageTitle, int pageIndex) { Map<String, String> dimensions = new HashMap<>(); dimensions.put("Issue Title", issue.getTitle()); dimensions.put("Page Title", pageTitle); dimensions.put("Page Index", String.valueOf(pageIndex)); ParseAnalytics.trackEventInBackground("View_Issue_Page", dimensions); sendEvent("Issue", "Page Views", issue.getTitle() + pageTitle); }
public static void notification(final String eventId, final String talkId, final boolean notificationsEnabled) { final Map<String, String> dimens = new ArrayMap<>(3); dimens.put(KEY_EVENT_ID, eventId); dimens.put(KEY_TALK_ID, talkId); dimens.put(KEY_NOTIFICATIONS_ENABLED, Boolean.toString(notificationsEnabled)); ParseAnalytics.trackEventInBackground("FavTalkNotification", dimens); }