Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 10 Current »

You can add custom strings, numbers and date variables. The information you set on each user can later be used to segment the users and create personalized dynamic push messages.

For example:

  • Add a user's first name to create personal push messages: " Hi John, we are...."

  • Add a user's birthday and use it to create a periodic birthday campaign to congratulate users on their birthday

  • Add a user's level in the game and use it to segment the users according to the level they have reached in your game

 iOS [Objective-C]
[[Appoxee shared] setDateValue:[NSDate date] forKey:@"key" withCompletionHandler:^(NSError * _Nullable appoxeeError, id _Nullable data) {

	if (!appoxeeError) {

		// Operation was successful.
	}
}];

[[Appoxee shared] setNumberValue:@(1.01) forKey:@"key" withCompletionHandler:^(NSError * _Nullable appoxeeError, id _Nullable data) {

	if (!appoxeeError) {

		// Operation was successful.
	}
}];

[[Appoxee shared] incrementNumericKey:@"key" byNumericValue:@(1.6) withCompletionHandler:^(NSError * _Nullable appoxeeError, id _Nullable data) {

	if (!appoxeeError) {

		// Operation was successful.
	}
}];

[[Appoxee shared] setStringValue:@"string" forKey:@"key" withCompletionHandler:^(NSError * _Nullable appoxeeError, id _Nullable data) {

	if (!appoxeeError) {

		// Operation was successful.
	}
}];

[[Appoxee shared] fetchCustomFieldByKey:@"CustomFieldKey" withCompletionHandler:^(NSError *appoxeeError, id data) {

	if (!appoxeeError && [data isKindOfClass:[NSDictionary class]]) {

		NSDictionary *dictionary = (NSDictionary *)data;
		NSString *key = [[dictionary allKeys] firstObject];
		id value = dictionary[key]; // can be of the following types: NSString || NSNumber || NSDate
	}

	// If there wan't an error, and data object is nil, then value doesn't exist on the device.
}];
 iOS [Swift]
 Appoxee.shared()?.setDateValue(NSDate(), forKey: "key", withCompletionHandler: { (appoxeeError, data) in
    
    if appoxeeError == nil {
     
        // Operation was successful.
    }
})

Appoxee.shared()?.setNumberValue(2, forKey: "key", withCompletionHandler: { (appoxeeError, data) in
    
    if appoxeeError == nil {
        
        // Operation was successful.
    }
})

Appoxee.shared()?.incrementNumericKey("key", byNumericValue: 1, withCompletionHandler: { (appoxeeError, data) in
    
    if appoxeeError == nil {
        
        // Operation was successful.
    }
})

Appoxee.shared()?.setStringValue("string", forKey: "key", withCompletionHandler: { (appoxeeError, data) in
    
    if appoxeeError == nil {
        
        // Operation was successful.
    }
})

Appoxee.shared()?.fetchCustomFieldByKey("key", withCompletionHandler: { (appoxeeError, data) in
    
    if appoxeeError == nil {
        
        if let dictionary = data as? NSDictionary {
            
            if let key = data?.allKeys.first {
                
                let value = dictionary.objectForKey(key)
            }
        }
    }
    
    // If there wan't an error, and data object is nil, then value doesn't exist on the device.
})
 Android [Java]
//Set string, numeric & date as attribute. Pass key for attribute name
public RequestStatus setAttribute(String key, String stringValue)
public RequestStatus setAttribute(String key, Number numericValue)
public RequestStatus setAttribute(String key, Date dateValue)
  
//use this syntax to set custom attribute
Appoxee.instance().setAttribute(key, value)



//Pass key, which you use to set attribute
public String getAttributeStringValue(String key)
  
//usse this syntax to get custom attribute
Appoxee.instance().getAttributeStringValue(key)


  • No labels