// Set the ID of the activity group to create the activities for.
Integer activityGroupId = Integer.parseInt("INSERT_ACTIVITY_GROUP_ID_HERE");
// Create a daily visits activity.
Activity dailyVisitsActivity = new Activity();
dailyVisitsActivity.setName("Activity #" + new Random().nextLong());
dailyVisitsActivity.setActivityGroupId(activityGroupId);
dailyVisitsActivity.setType(ActivityType.DAILY_VISITS);
// Create a custom activity.
Activity customActivity = new Activity();
customActivity.setName("Activity #" + new Random().nextLong());
customActivity.setActivityGroupId(activityGroupId);
customActivity.setType(ActivityType.CUSTOM);
// Create the activities on the server.
Activity[] activities =
activityService.createActivities(new Activity[] {dailyVisitsActivity, customActivity});