Add Custom Evnet
- Optional. If there is an event/log in the game that needs to be logged or analyzed, use the method to transfer the data that needs to be recorded. For example, record payment data about an activity.
Method
java
public static void gamedreamerEvent(Activity activity, String eventType, Map<String, Object> mapEvent)Parameters
| Parameter | Description |
|---|---|
| activity | Activity object |
| eventType | Custom event name |
| mapEvent | The custom event data that needs to be recorded. |
- SDK provides several alternative events, As shown in the table below:
| Event | Description | Parameter |
|---|---|---|
| GDEventType.EventTutorial_completion | Complete the novice task | null |
| GDEventType.EventLevelAchieved | Player's role level achieved. | the key of the parameter is GDEventType.GDEVENTPARAM_KEY, the value is player’s role level. |
| GDEventType.EventEnterPayment | Open payment page | null |
| GDEventType.EvnetActiveDays | Active days | the key of the parameter is GDEventType.GDEVENTPARAM_KEY, the value is player’s active days. |
- The game can access the above events as needed, and can also edit the custom game events.
Example Code
java
// 事件:完成新手任务
GDSDK.gamedreamerEvent(this, GDEventType.GD_EVENT_TUTORIAL_COMPLETION,null);
// 事件:角色等级达到20
Map<String, Object> eventMap=new HashMap<String, Object>();
eventMap.put(GDEventType.GD_EVENT_PARAM_KEY, 20);
GDSDK.gamedreamerEvent(this, GDEventType.GD_EVENT_LEVEL_ACHIEVED,eventMap);
// 事件:vip等级到达5
Map<String, Object> eventMap1=new HashMap<String, Object>();
eventMap1.put(GDEventType.GD_EVENT_PARAM_KEY, 5);
GDSDK.gamedreamerEvent(this, GDEventType.GD_EVENT_VIP_LEVEL,eventMap1);