{"__v":2,"_id":"55a90c56cf45e1390093f2bf","category":{"__v":12,"_id":"55a8e7a227a17d21005251a2","pages":["55a8feb327a17d2100525201","55a9021527a17d2100525208","55a9035927a17d210052520b","55a903cfcf45e1390093f29e","55a9049727a17d210052520f","55a9059a27a17d2100525217","55a9066527a17d210052521e","55a9075bcf45e1390093f2a9","55a9090927a17d2100525228","55a90b30c8bd450d000dd164","55a90c56cf45e1390093f2bf","55a9102bc8bd450d000dd170"],"project":"559a61d2dbcfd20d00710b39","version":"559a61d2dbcfd20d00710b3c","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-07-17T11:31:46.263Z","from_sync":false,"order":2,"slug":"ios-sdk-reference","title":"iOS SDK Reference"},"parentDoc":null,"project":"559a61d2dbcfd20d00710b39","user":"559a618bdbcfd20d00710b38","version":{"__v":23,"_id":"559a61d2dbcfd20d00710b3c","project":"559a61d2dbcfd20d00710b39","createdAt":"2015-07-06T11:09:06.510Z","releaseDate":"2015-07-06T11:09:06.510Z","categories":["559a61d3dbcfd20d00710b3d","55a589ddaaf9cf1900114dd0","55a589e30f354f0d00fd0312","55a589ea80c8a30d00b323cc","55a589f6aaf9cf1900114dd1","55a58d4e80c8a30d00b323e6","55a8e7a227a17d21005251a2","55a93098cf45e1390093f351","55afb085f202b12100cd9e83","55afb22e902fd51700f5f8bf","55afb260902fd51700f5f8c2","55afb28ec8a85321007a5462","55afb294f202b12100cd9e95","55afb29b902fd51700f5f8c5","55afb2a1c8a85321007a5463","55afb2a7902fd51700f5f8c7","55afb2ad902fd51700f5f8c8","55afb2b5902fd51700f5f8ca","55b74b2131bccb190081bedc","55bb441b54f9640d006e6cf2","565711085cb2420d00d70071","5681681330018c0d006bf7ff","588f38b5923d610f00c72dad"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"Version 1.0","version_clean":"1.0.0","version":"1"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-07-17T14:08:22.327Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":11,"body":"You may also customize actions using MOCAProximityActionsDelegate:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \":::at:::protocol MOCAProximityActionsDelegate <NSObject>\\n\\n@optional\\n\\n/**\\n * Called to determine if a specific proximity action can be executed now.\\n * @param service - proximity service instance\\n *\\n * Discussion\\n *\\n * It is typically implemented by the hosting app that wants to control\\n * when the experiences should be displayed and when not.\\n * \\n * Example\\n *\\n * An app that displays a splash screen may want to enable proximity actions\\n * to be displayed only after displaying the home screen.\\n */\\n-(BOOL)actionCanDisplayNow:(MOCAAction*)sender withSituation:(MOCAFireSituation)situation;\\n\\n/**\\n * Called when action if fired and accepted by actionCanDisplayNow() method.\\n * This method is invoked for all action types and should be used to perform generic action logic.\\n * @return YES if action execution flow should proceed, or NO otherwise.\\n */\\n-(BOOL)action:(MOCAAction*)sender withSituation:(MOCAFireSituation)situation;\\n\\n/**\\n * Called when an alert notification should be displayed to a user.\\n * @param alertMessage a simple string to be displayed as an alert\\n * @return YES if the alert was shown to the user, NO otherwise.\\n */\\n-(BOOL)action:(MOCAAction*)sender displayNotificationAlert:(NSString *)alertMessage withSituation:(MOCAFireSituation)situation;\\n\\n/*\\n * Called when a URL content should be displayed to a user.\\n * @param url a content URL to be displayed\\n * @return YES if the alert was shown to the user, NO otherwise.\\n */\\n-(BOOL)action:(MOCAAction*)sender openUrl:(NSURL*)url withSituation:(MOCAFireSituation)situation;\\n\\n/*\\n * Called when a embedded HTML content should be displayed to a user.\\n * @param html a HTML content to be displayed\\n * @return YES if the alert was shown to the user, NO otherwise.\\n */\\n-(BOOL)action:(MOCAAction*)sender showHtmlWithString:(NSString*)html withSituation:(MOCAFireSituation)situation;\\n\\n/*\\n * Called when a video from URL should be played to a user.\\n * @param url - video content URL\\n * @return YES if the alert was shown to the user, NO otherwise.\\n */\\n-(BOOL)action:(MOCAAction*)sender playVideoFromUrl:(NSURL*)url withSituation:(MOCAFireSituation)situation;\\n\\n/*\\n * Called when an image from URL should be displayed to a user.\\n * @param url - image URL\\n * @return YES if the alert was shown to the user, NO otherwise.\\n */\\n-(BOOL)action:(MOCAAction*)sender displayImageFromUrl:(NSURL*)url withSituation:(MOCAFireSituation)situation;\\n\\n/*\\n * Called when a Passbook pass card from URL should be displayed to a user.\\n * @param url - pass URL\\n * @return YES if the alert was shown to the user, NO otherwise.\\n */\\n-(BOOL)action:(MOCAAction*)sender displayPassFromUrl:(NSURL*)url withSituation:(MOCAFireSituation)situation;\\n\\n/*\\n * Called when a user should be tagged.\\n * @param tagName name of the tag\\n * @param value value to be added\\n * @return YES if the tag should be added to user profile, NO otherwise.\\n */\\n-(BOOL)action:(MOCAAction*)sender addTag:(NSString*)tagName withValue:(NSString*)value;\\n\\n/*\\n * Called when a sound notification should be played.\\n * @param soundFilename The sound file to play or `default` for the standard notification sound.\\n * This file must be included in the application bundle or available in system bundle.\\n * @return YES if the alert was shown to the user, NO otherwise.\\n */\\n-(BOOL)action:(MOCAAction*)sender playNotificationSound:(NSString *)soundFilename withSituation:(MOCAFireSituation)situation;\\n\\n/*\\n * Called when the app should execute a custom action.\\n * @param customAttribute - user provided custom attribute\\n * @return YES if the alert was shown to the user, NO otherwise.\\n */\\n-(BOOL)action:(MOCAAction*)sender performCustomAction:(NSString*)customAttribute withSituation:(MOCAFireSituation)situation;\\n\\n/** \\n * Called to customize the app root view that should be used to display overlay popup window.\\n * @param view - default superview to add the overlay to as a child view.\\n * @return selected view to be used as superview.\\n */\\n-(UIView*)willShowOverlayInView:(UIView*) superview;\\n\\n@end\\n\\n\",\n      \"language\": \"objectivec\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"Use these methods to **override** MOCA SDK default behavior.\"\n}\n[/block]","excerpt":"","slug":"proximity-actions-delegate","type":"basic","title":"Proximity Actions Delegate"}

Proximity Actions Delegate


You may also customize actions using MOCAProximityActionsDelegate: [block:code] { "codes": [ { "code": "@protocol MOCAProximityActionsDelegate <NSObject>\n\n@optional\n\n/**\n * Called to determine if a specific proximity action can be executed now.\n * @param service - proximity service instance\n *\n * Discussion\n *\n * It is typically implemented by the hosting app that wants to control\n * when the experiences should be displayed and when not.\n * \n * Example\n *\n * An app that displays a splash screen may want to enable proximity actions\n * to be displayed only after displaying the home screen.\n */\n-(BOOL)actionCanDisplayNow:(MOCAAction*)sender withSituation:(MOCAFireSituation)situation;\n\n/**\n * Called when action if fired and accepted by actionCanDisplayNow() method.\n * This method is invoked for all action types and should be used to perform generic action logic.\n * @return YES if action execution flow should proceed, or NO otherwise.\n */\n-(BOOL)action:(MOCAAction*)sender withSituation:(MOCAFireSituation)situation;\n\n/**\n * Called when an alert notification should be displayed to a user.\n * @param alertMessage a simple string to be displayed as an alert\n * @return YES if the alert was shown to the user, NO otherwise.\n */\n-(BOOL)action:(MOCAAction*)sender displayNotificationAlert:(NSString *)alertMessage withSituation:(MOCAFireSituation)situation;\n\n/*\n * Called when a URL content should be displayed to a user.\n * @param url a content URL to be displayed\n * @return YES if the alert was shown to the user, NO otherwise.\n */\n-(BOOL)action:(MOCAAction*)sender openUrl:(NSURL*)url withSituation:(MOCAFireSituation)situation;\n\n/*\n * Called when a embedded HTML content should be displayed to a user.\n * @param html a HTML content to be displayed\n * @return YES if the alert was shown to the user, NO otherwise.\n */\n-(BOOL)action:(MOCAAction*)sender showHtmlWithString:(NSString*)html withSituation:(MOCAFireSituation)situation;\n\n/*\n * Called when a video from URL should be played to a user.\n * @param url - video content URL\n * @return YES if the alert was shown to the user, NO otherwise.\n */\n-(BOOL)action:(MOCAAction*)sender playVideoFromUrl:(NSURL*)url withSituation:(MOCAFireSituation)situation;\n\n/*\n * Called when an image from URL should be displayed to a user.\n * @param url - image URL\n * @return YES if the alert was shown to the user, NO otherwise.\n */\n-(BOOL)action:(MOCAAction*)sender displayImageFromUrl:(NSURL*)url withSituation:(MOCAFireSituation)situation;\n\n/*\n * Called when a Passbook pass card from URL should be displayed to a user.\n * @param url - pass URL\n * @return YES if the alert was shown to the user, NO otherwise.\n */\n-(BOOL)action:(MOCAAction*)sender displayPassFromUrl:(NSURL*)url withSituation:(MOCAFireSituation)situation;\n\n/*\n * Called when a user should be tagged.\n * @param tagName name of the tag\n * @param value value to be added\n * @return YES if the tag should be added to user profile, NO otherwise.\n */\n-(BOOL)action:(MOCAAction*)sender addTag:(NSString*)tagName withValue:(NSString*)value;\n\n/*\n * Called when a sound notification should be played.\n * @param soundFilename The sound file to play or `default` for the standard notification sound.\n * This file must be included in the application bundle or available in system bundle.\n * @return YES if the alert was shown to the user, NO otherwise.\n */\n-(BOOL)action:(MOCAAction*)sender playNotificationSound:(NSString *)soundFilename withSituation:(MOCAFireSituation)situation;\n\n/*\n * Called when the app should execute a custom action.\n * @param customAttribute - user provided custom attribute\n * @return YES if the alert was shown to the user, NO otherwise.\n */\n-(BOOL)action:(MOCAAction*)sender performCustomAction:(NSString*)customAttribute withSituation:(MOCAFireSituation)situation;\n\n/** \n * Called to customize the app root view that should be used to display overlay popup window.\n * @param view - default superview to add the overlay to as a child view.\n * @return selected view to be used as superview.\n */\n-(UIView*)willShowOverlayInView:(UIView*) superview;\n\n@end\n\n", "language": "objectivec" } ] } [/block] [block:callout] { "type": "warning", "body": "Use these methods to **override** MOCA SDK default behavior." } [/block]