{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","params":[],"results":{"codes":[]},"settings":""},"next":{"description":"","pages":[]},"title":"Managing Pulsate Sessions","type":"basic","slug":"running-the-android-pulsate-sdk","excerpt":"","body":"Before trying to run Pulsate make sure you have properly installed Pulsate - https://pulsate.readme.io/v2.8/docs/installing-the-android-pulsate-sdk\n\nTo start a session all that you need to do is call \"*startPulsateSession*\" or \"*startPulsateSessionForAlias*\". Below we will explain both methods and what is different.\n\nPulsate automatically starts and ends sessions for you after you start the first session. The sessions will be automatically managed for you until you logout the user from Pulsate. If you do not need to logout the user don't do it.\n[block:callout]\n{\n  \"type\": \"danger\",\n  \"title\": \"Starting a Pulsate Session requires an Activity\",\n  \"body\": \"Starting a session in the *\\\"onCreate()\\\"* method of your Application class is not supported.\\nPulsate requires an active activity to start, so wait for the first Activity \\\"*onCreate*\\\" callback before starting a session.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"1. Simple Session - startPulsateSession\"\n}\n[/block]\nSimple Sessions use a \"Device Guid\" to identify this user on this device. Everytime \"Device Guid\" changes a new user is created and the old user data can no longer be connected to the new user. \nIf the user has multiple devices or updates his current device each device will have a different \"Device Guid\" and will be a different user in our system. \"Device Guid\" can also change if the user reinstalls the App, formats his device or clears App Data.\n\nIn order to start a simple session use the *startPulsateSession:* method.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"IPulsateManager manager = PulsateFactory.getInstance();\\npulsateManager.startPulsateSession(new IPulsateRequestListener() {\\n    :::at:::Override\\n    public void onSucess() {\\n    }\\n\\n    @Override\\n    public void onError(Throwable e) {\\n    }\\n  });\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"2. Deduping Session - startPulsateSessionForAlias\"\n}\n[/block]\nDeduping is the process of setting a unique identifier for a user as their customer alias so that we can recognise when that user uses your app on multiple devices. Deduping helps to improve data quality by ensuring that the same user can have multiple devices added to their profile instead of different Pulsate profiles being created for each device. \n\nThe customer alias can be any identifier that you choose that will not change for that user. Customer Number is an example of a suitable identifier that would make a good alias because customer number is a parameter that is unlikely to change. Conversely, an email address is not a good choice as an identifier because there is a strong possibility that a user could change their email in the future.\n\nIn order to use the deduping feature, you need to use the *startPulsateSessionForAlias:* method, instead of *startPulsateSession* on the *PulsateManager*. You need to pass the unique client identifier as the parameter.\n\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"IPulsateManager pulsateManager = PulsateFactory.getInstance();\\npulsateManager.startPulsateSessionForAlias(\\\"my_user_alias\\\", new IPulsateRequestListener() {\\n    @Override\\n    public void onSucess() {\\n    }\\n\\n    @Override\\n    public void onError(Throwable e) {\\n    }\\n  });\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"3. Logout\"\n}\n[/block]\nIf your user logs out, in order for him to stop sending data and getting new campaigns you need to call the *logoutCurrentAlias* method.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"pulsateManager.logoutCurrentAlias(new IPulsateRequestListener() {\\n  @Override\\n  public void onSucess() {\\n  }\\n  \\n  @Override\\n  public void onError(Throwable e) {\\n  }\\n});\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]","updates":[],"order":1,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"5f2ab116bc35e507e8ceace3","createdAt":"2020-08-05T13:16:06.507Z","user":"57bc3654b9c7f0220009c77b","category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"SDK Quick Start","slug":"sdk-quick-start","order":1,"from_sync":false,"reference":false,"_id":"5f2ab0dfbf70f7063ad0c4f3","createdAt":"2020-08-05T13:15:11.164Z","version":"5e5019b49e8f240011cc6ade","project":"54aa7f773b56130b0056c86e","__v":0},"version":{"version":"2.8","version_clean":"2.8.0","codename":"Android SDK","is_stable":false,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["5e5019b49e8f240011cc6a47","55781fe35129590d003ff4f9","55781fe35129590d003ff4fa","5e5019b49e8f240011cc6a48","5e5019b49e8f240011cc6a49","5e5019b49e8f240011cc6a4a","5e5019b49e8f240011cc6a4b","5e5019b49e8f240011cc6a4c","565b66c446118c0d00dcb0bb","56898269f8dc340d00308c13","5e5019b49e8f240011cc6a4d","5e5019b49e8f240011cc6a4e","5c73dd27e8fdc000572a206a","5e5019b49e8f240011cc6a4f","5e501b7e7c8bdc00450ea66a","5e53daa9884b750025b5cad4","5f2ab0dfbf70f7063ad0c4f3","5f2ab1e9448d87068b348f9c","5f2ab1f9c1644603559149ac","5f2ab205bc35e507e8cead35"],"_id":"5e5019b49e8f240011cc6ade","project":"54aa7f773b56130b0056c86e","forked_from":"5e4fbbbda8fb41028f1861fe","__v":6,"createdAt":"2015-06-10T11:30:42.700Z","releaseDate":"2015-06-10T11:30:42.700Z"},"project":"54aa7f773b56130b0056c86e","__v":0,"parentDoc":null}

Managing Pulsate Sessions


Before trying to run Pulsate make sure you have properly installed Pulsate - https://pulsate.readme.io/v2.8/docs/installing-the-android-pulsate-sdk To start a session all that you need to do is call "*startPulsateSession*" or "*startPulsateSessionForAlias*". Below we will explain both methods and what is different. Pulsate automatically starts and ends sessions for you after you start the first session. The sessions will be automatically managed for you until you logout the user from Pulsate. If you do not need to logout the user don't do it. [block:callout] { "type": "danger", "title": "Starting a Pulsate Session requires an Activity", "body": "Starting a session in the *\"onCreate()\"* method of your Application class is not supported.\nPulsate requires an active activity to start, so wait for the first Activity \"*onCreate*\" callback before starting a session." } [/block] [block:api-header] { "type": "basic", "title": "1. Simple Session - startPulsateSession" } [/block] Simple Sessions use a "Device Guid" to identify this user on this device. Everytime "Device Guid" changes a new user is created and the old user data can no longer be connected to the new user. If the user has multiple devices or updates his current device each device will have a different "Device Guid" and will be a different user in our system. "Device Guid" can also change if the user reinstalls the App, formats his device or clears App Data. In order to start a simple session use the *startPulsateSession:* method. [block:code] { "codes": [ { "code": "IPulsateManager manager = PulsateFactory.getInstance();\npulsateManager.startPulsateSession(new IPulsateRequestListener() {\n @Override\n public void onSucess() {\n }\n\n @Override\n public void onError(Throwable e) {\n }\n });", "language": "java" } ] } [/block] [block:api-header] { "type": "basic", "title": "2. Deduping Session - startPulsateSessionForAlias" } [/block] Deduping is the process of setting a unique identifier for a user as their customer alias so that we can recognise when that user uses your app on multiple devices. Deduping helps to improve data quality by ensuring that the same user can have multiple devices added to their profile instead of different Pulsate profiles being created for each device. The customer alias can be any identifier that you choose that will not change for that user. Customer Number is an example of a suitable identifier that would make a good alias because customer number is a parameter that is unlikely to change. Conversely, an email address is not a good choice as an identifier because there is a strong possibility that a user could change their email in the future. In order to use the deduping feature, you need to use the *startPulsateSessionForAlias:* method, instead of *startPulsateSession* on the *PulsateManager*. You need to pass the unique client identifier as the parameter. [block:code] { "codes": [ { "code": "IPulsateManager pulsateManager = PulsateFactory.getInstance();\npulsateManager.startPulsateSessionForAlias(\"my_user_alias\", new IPulsateRequestListener() {\n @Override\n public void onSucess() {\n }\n\n @Override\n public void onError(Throwable e) {\n }\n });", "language": "java" } ] } [/block] [block:api-header] { "title": "3. Logout" } [/block] If your user logs out, in order for him to stop sending data and getting new campaigns you need to call the *logoutCurrentAlias* method. [block:code] { "codes": [ { "code": "pulsateManager.logoutCurrentAlias(new IPulsateRequestListener() {\n @Override\n public void onSucess() {\n }\n \n @Override\n public void onError(Throwable e) {\n }\n});", "language": "java" } ] } [/block]