{"__v":2,"_id":"55a930bdcf45e1390093f353","category":{"__v":11,"_id":"55a93098cf45e1390093f351","pages":["55a930bdcf45e1390093f353","55a932afc8bd450d000dd1d6","55a938ba4c661b3700cf4e1f","55a939b502becf2d007aac34","55a93a015d3abb0d0012f184","55a93b225d3abb0d0012f191","55a93c4002becf2d007aac43","55a93d4c02becf2d007aac4c","55a940485d3abb0d0012f1af","55a9409802becf2d007aac64","55a9410c5d3abb0d0012f1b4"],"project":"559a61d2dbcfd20d00710b39","version":"559a61d2dbcfd20d00710b3c","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-07-17T16:43:04.054Z","from_sync":false,"order":4,"slug":"android-sdk-reference","title":"Android 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-17T16:43:41.170Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"The `MOCA static class` is a main entry point to MOCA APIs.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\n\\t/**\\n\\t * Returns the current MOCA SDK version.\\n\\t * \\n\\t * :::at:::return The version of the MOCA SDK library.\\n\\t */\\n\\tpublic static String getVersion()\\n\\t\\n\\t/**\\n\\t * Return the key of this application in MOCA service.\\n\\t * \\n\\t * @return MOCA app key.\\n\\t */\\n\\tpublic static String getAppKey()\\n\\t\\n\\t/**\\n\\t * Return the secret key of this application in MOCA service.\\n\\t * \\n\\t * @return MOCA app secret.\\n\\t */\\n\\tpublic static String getAppSecret()\\n\\t\\n\\t/**\\n\\t * Gets the level of logging that will be displayed.\\n\\t */\\n\\tpublic static MOCALogLevel getLogLevel()\\n\\n\\t/**\\n\\t * Returns the current Application.\\n\\t * \\n\\t * @return The current application.\\n\\t */\\n\\tpublic static Application getApplication () \\n\\n  /**\\n   * Gets instance object.\\n   */\\n  public static MOCAInstance getInstance ()\\n \\n\\t/**\\n\\t * Provides access to MOCA Proximity Service. This service is only available\\n\\t * on Android 4.4 and newer.\\n\\t * \\n\\t * @return MOCAProximityService instance or null if it is not available or\\n\\t *         has not been initialized.\\n\\t */\\n\\tpublic static MOCAProximityService getProximityService()\\n\\n\\t/**\\n\\t * Returns true if MOCA Proximity Service is available on this device.\\n\\t * \\n\\t * @return true if the proximity service is available on this device.\\n     * Note: it can be disabled by configuration.\\n\\t */\\n\\tpublic static boolean isProximityAvailable()\\n\\n  /**\\n   * Returns true if MOCA Proximity Service is available and enabled.\\n   *\\n   * @return true if the proximity service is enabled, or false otherwise.\\n   */\\n  public static boolean proximityEnabled ()\\n\\n  /**\\n   * Starts/stops MOCA Proximity service.\\n   * @param enable\\n   */\\n  public static void setProximityEnabled (boolean enable) \\n\\n  private static final String\\tMOCA_AUTOINIT_ON_PUSH_KEY\\t= \\\"MOCA_AUTO_INIT_ON_PUSH\\\";\\n\\n  /**\\n   * Global settings. Enables MOCA to auto-initialize SDK on certain events.\\n   */\\n  public static void setAutoInitOnPush (Context context, boolean enable)\\n    \\n  public static boolean getAutoInitOnPush (Context context)\\n\\t\\n  /**\\n\\t * Tracks a custom in-app event.\\n\\t * \\n\\t * @param verb Action verb.\\n\\t * @return <code>YES</code> in case of success, <code>NO</code> in case of\\n\\t *         error.\\n\\t */\\n\\tpublic static boolean track(final String verb)\\n\\t\\n\\t/**\\n\\t * Tracks an event.\\n\\t * \\n\\t * @param verb Action verb.\\n\\t * @param value Value associated with the event.\\n\\t * @return <code>YES</code> in case of success, <code>NO</code> in case of\\n\\t *         error.\\n\\t */\\n\\tpublic static boolean track(final String verb, long value)\\n\\n\\t/**\\n\\t * Tracks an event.\\n\\t * \\n\\t * @param verb Action verb.\\n\\t * @param item Item associated with the event.\\n\\t * @return <code>YES</code> in case of success, <code>NO</code> in case of\\n\\t *         error.\\n\\t */\\n\\tpublic static boolean track(final String verb, final String item)\\n\\n\\t/**\\n\\t * Tracks an event.\\n\\t * \\n\\t * @param verb Action verb.\\n\\t * @param item Item associated with the event.\\n\\t * @param value Value associated with the event.\\n\\t * @return <code>YES</code> in case of success, <code>NO</code> in case of\\n\\t *         error.\\n\\t */\\n\\tpublic static boolean track(final String verb, final String item, final long value)\\n\\n\\t/**\\n\\t * Tracks an event.\\n\\t * \\n\\t * @param verb Action verb.\\n\\t * @param item Item associated with the event.\\n\\t * @param category Category the item belongs to.\\n\\t * @return <code>YES</code> in case of success, <code>NO</code> in case of\\n\\t *         error.\\n\\t */\\n\\tpublic static boolean track(final String verb, final String category, final String item)\\n\\n\\t/**\\n\\t * Tracks an event.\\n\\t * \\n\\t * @param verb Action verb.\\n\\t * @param item Item associated with the event.\\n\\t * @param category Category the item belongs to.\\n\\t * @param value Value associated with the event.\\n\\t * @return <code>YES</code> in case of success, <code>NO</code> in case of\\n\\t *         error.\\n\\t */\\n\\tpublic static boolean track(final String verb, final String category, final String item, final long value)\\n\\n\\t/**\\n\\t * Tracks an event with custom attributes.\\n\\t * \\n\\t * @param verb Action verb.\\n\\t * @param attrs Collection of attributes associated with this event (up to\\n\\t *            10). Value types are restricted to: {@link String},\\n\\t *            {@link Integer}, {@link Long}, {@link Double}, {@link Float},\\n\\t *            {@link Date} and {@link Location}.\\n\\t * @return <code>YES</code> in case of success, <code>NO</code> in case of\\n\\t *         error.\\n\\t */\\n\\tpublic static boolean track(final String verb, final Map<String, Object> attrs)\\n\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"moca-api","type":"basic","title":"MOCA API"}
The `MOCA static class` is a main entry point to MOCA APIs. [block:code] { "codes": [ { "code": "\n\t/**\n\t * Returns the current MOCA SDK version.\n\t * \n\t * @return The version of the MOCA SDK library.\n\t */\n\tpublic static String getVersion()\n\t\n\t/**\n\t * Return the key of this application in MOCA service.\n\t * \n\t * @return MOCA app key.\n\t */\n\tpublic static String getAppKey()\n\t\n\t/**\n\t * Return the secret key of this application in MOCA service.\n\t * \n\t * @return MOCA app secret.\n\t */\n\tpublic static String getAppSecret()\n\t\n\t/**\n\t * Gets the level of logging that will be displayed.\n\t */\n\tpublic static MOCALogLevel getLogLevel()\n\n\t/**\n\t * Returns the current Application.\n\t * \n\t * @return The current application.\n\t */\n\tpublic static Application getApplication () \n\n /**\n * Gets instance object.\n */\n public static MOCAInstance getInstance ()\n \n\t/**\n\t * Provides access to MOCA Proximity Service. This service is only available\n\t * on Android 4.4 and newer.\n\t * \n\t * @return MOCAProximityService instance or null if it is not available or\n\t * has not been initialized.\n\t */\n\tpublic static MOCAProximityService getProximityService()\n\n\t/**\n\t * Returns true if MOCA Proximity Service is available on this device.\n\t * \n\t * @return true if the proximity service is available on this device.\n * Note: it can be disabled by configuration.\n\t */\n\tpublic static boolean isProximityAvailable()\n\n /**\n * Returns true if MOCA Proximity Service is available and enabled.\n *\n * @return true if the proximity service is enabled, or false otherwise.\n */\n public static boolean proximityEnabled ()\n\n /**\n * Starts/stops MOCA Proximity service.\n * @param enable\n */\n public static void setProximityEnabled (boolean enable) \n\n private static final String\tMOCA_AUTOINIT_ON_PUSH_KEY\t= \"MOCA_AUTO_INIT_ON_PUSH\";\n\n /**\n * Global settings. Enables MOCA to auto-initialize SDK on certain events.\n */\n public static void setAutoInitOnPush (Context context, boolean enable)\n \n public static boolean getAutoInitOnPush (Context context)\n\t\n /**\n\t * Tracks a custom in-app event.\n\t * \n\t * @param verb Action verb.\n\t * @return <code>YES</code> in case of success, <code>NO</code> in case of\n\t * error.\n\t */\n\tpublic static boolean track(final String verb)\n\t\n\t/**\n\t * Tracks an event.\n\t * \n\t * @param verb Action verb.\n\t * @param value Value associated with the event.\n\t * @return <code>YES</code> in case of success, <code>NO</code> in case of\n\t * error.\n\t */\n\tpublic static boolean track(final String verb, long value)\n\n\t/**\n\t * Tracks an event.\n\t * \n\t * @param verb Action verb.\n\t * @param item Item associated with the event.\n\t * @return <code>YES</code> in case of success, <code>NO</code> in case of\n\t * error.\n\t */\n\tpublic static boolean track(final String verb, final String item)\n\n\t/**\n\t * Tracks an event.\n\t * \n\t * @param verb Action verb.\n\t * @param item Item associated with the event.\n\t * @param value Value associated with the event.\n\t * @return <code>YES</code> in case of success, <code>NO</code> in case of\n\t * error.\n\t */\n\tpublic static boolean track(final String verb, final String item, final long value)\n\n\t/**\n\t * Tracks an event.\n\t * \n\t * @param verb Action verb.\n\t * @param item Item associated with the event.\n\t * @param category Category the item belongs to.\n\t * @return <code>YES</code> in case of success, <code>NO</code> in case of\n\t * error.\n\t */\n\tpublic static boolean track(final String verb, final String category, final String item)\n\n\t/**\n\t * Tracks an event.\n\t * \n\t * @param verb Action verb.\n\t * @param item Item associated with the event.\n\t * @param category Category the item belongs to.\n\t * @param value Value associated with the event.\n\t * @return <code>YES</code> in case of success, <code>NO</code> in case of\n\t * error.\n\t */\n\tpublic static boolean track(final String verb, final String category, final String item, final long value)\n\n\t/**\n\t * Tracks an event with custom attributes.\n\t * \n\t * @param verb Action verb.\n\t * @param attrs Collection of attributes associated with this event (up to\n\t * 10). Value types are restricted to: {@link String},\n\t * {@link Integer}, {@link Long}, {@link Double}, {@link Float},\n\t * {@link Date} and {@link Location}.\n\t * @return <code>YES</code> in case of success, <code>NO</code> in case of\n\t * error.\n\t */\n\tpublic static boolean track(final String verb, final Map<String, Object> attrs)\n", "language": "java" } ] } [/block]