{"_id":"5a6b684793313c005b692e0f","category":{"_id":"5a6b684793313c005b692e08","version":"5a6b684793313c005b692e07","project":"57c87ef85754fa1700b1228d","__v":0,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-09-18T01:38:20.281Z","from_sync":false,"order":0,"slug":"getting-started","title":"Getting Started"},"user":"57c73a03e6935b1700b15115","project":"57c87ef85754fa1700b1228d","version":{"_id":"5a6b684793313c005b692e07","project":"57c87ef85754fa1700b1228d","__v":1,"createdAt":"2018-01-26T17:41:27.297Z","releaseDate":"2018-01-26T17:41:27.297Z","categories":["5a6b684793313c005b692e08","5a6b684793313c005b692e09","5a6b684793313c005b692e0a","5a6b684793313c005b692e0b"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"3.5.3","version":"3.5.3"},"__v":0,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-05-05T19:26:35.016Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":3,"body":"[block:api-header]\n{\n  \"title\": \"Create Activity for Welcome Screens Only\"\n}\n[/block]\nCreate an Activity that extends from **AbstractPrimerWelcomeActivity** if your app only wants to show welcome screens for new users. \n\nYou must implement the following required methods for this `Activity`. \n\n- `Intent getDidPresentIntent()` - Should return the Intent of your Main Activity. We will call startActivity() with this intent when we are finished showing our screens. \n\n- `Intent getDidNotPresentIntent()` - Should return the intent representing your native new user onboarding.\n\n- `boolean isFirstTimeStart()` - Should return true if this is the very first time a user is starting your app. False otherwise.\n\n- `int getSplashLayoutResId()` - Must return a Layout resource identifier. Primer will inflate this resource and display it to the user when we are loading our data. It should resemble a splash screen.\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"/**\\n * Launch activity will only show welcome screens on the very first launch.\\n */\\npublic class LaunchActivity extends AbstractPrimerWelcomeActivity {\\n\\n    /**\\n     * :::at:::return - the {@link Intent} that Primer will fire\\n     * when finished with the Primer experience.\\n     * Note: this will not be fired if the user cancels the experience\\n     */\\n    @Override\\n    protected Intent getDidPresentIntent() {\\n        return new Intent(this, MainActivity.class);\\n    }\\n\\n    /**\\n     * @return - The {@link Intent} that Primer will fire\\n     * when Primer will not show its screens (ex. already logged in)\\n     */\\n    @Override\\n    protected Intent getDidNotPresentIntent() {\\n        return new Intent(this, NativeOnboardingActivity.class);\\n    }\\n\\n    /**\\n     * @return - The resource ID of the layout to use for the splash screen.\\n     */\\n    @Override\\n    protected int getSplashLayoutResId() {\\n        return R.layout.splash;\\n    }\\n  \\n    /**\\n    * Return true if this is the very first time this user has launched\\n    * your app. Return false if the user has already launched your app.\\n    */\\n    @Override\\n    protected boolean isFirstTimeStart() {\\n        return mPreferences.contains(\\\"started_app_before\\\");\\n    }\\n}\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\nDon't forget to add this new Activity to your app's Manifest.xml file.  \n\n- All of our layouts are optimized for Portrait only. Lock the orientation to `portrait` only.\n- There should only be one instance of this Activity in a task, so configure the `launchMode` to `singleTask`\n- We provide a custom Theme for this Activity which assist the presentation of our screens. This is not required, and you can duplicate it and edit if you desire. \n- Make sure that the Activity does not declare noHistory == true\n\nThe configuration below will place Primer as the launch Activity. \n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<activity android:name=\\\".LaunchActivity\\\"\\n          android:launchMode=\\\"singleTask\\\"\\n          android:screenOrientation=\\\"portrait\\\"\\n          android:theme=\\\"@style/PrimerFull\\\"\\n          android:label=\\\"YOUR_APP_LABEL\\\"\\n          android:noHistory=\\\"false\\\"\\n          android:windowSoftInputMode=\\\"adjustPan\\\">\\n          <intent-filter>\\n                <action android:name=\\\"android.intent.action.MAIN\\\"/>\\n                <category android:name=\\\"android.intent.category.LAUNCHER\\\"/>\\n          </intent-filter>\\n</activity>\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"Be sure to audit your MAIN and LAUNCHER intent filters when adding this Activity to your manifest. (Ensure you only want one launcher Activity.) Also ensure that you property refactor any install events or other things that were driven by your previous launch activity. \\n\\nAlso ensure that the launch mode is singleTask.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"title\": \"Flows Launched!\"\n}\n[/block]\nBuild and run your application to see the automatic Primer onboarding experience!\nYou can design and edit your flows easily on the Dashboard.\n\nBecause our flow will only show the very first time the app is launched, you should clear your app data every time you want to see the Primer experience.\n\n[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"Go to the Dashboard and ensure that your organic flow is currently running. If it isn't, no flow will appear on initialization.\",\n  \"title\": \"Not seeing anything appear?\"\n}\n[/block]","excerpt":"","slug":"welcome_activity","type":"basic","title":"Welcome Only Onboarding"}

Welcome Only Onboarding


[block:api-header] { "title": "Create Activity for Welcome Screens Only" } [/block] Create an Activity that extends from **AbstractPrimerWelcomeActivity** if your app only wants to show welcome screens for new users. You must implement the following required methods for this `Activity`. - `Intent getDidPresentIntent()` - Should return the Intent of your Main Activity. We will call startActivity() with this intent when we are finished showing our screens. - `Intent getDidNotPresentIntent()` - Should return the intent representing your native new user onboarding. - `boolean isFirstTimeStart()` - Should return true if this is the very first time a user is starting your app. False otherwise. - `int getSplashLayoutResId()` - Must return a Layout resource identifier. Primer will inflate this resource and display it to the user when we are loading our data. It should resemble a splash screen. [block:code] { "codes": [ { "code": "/**\n * Launch activity will only show welcome screens on the very first launch.\n */\npublic class LaunchActivity extends AbstractPrimerWelcomeActivity {\n\n /**\n * @return - the {@link Intent} that Primer will fire\n * when finished with the Primer experience.\n * Note: this will not be fired if the user cancels the experience\n */\n @Override\n protected Intent getDidPresentIntent() {\n return new Intent(this, MainActivity.class);\n }\n\n /**\n * @return - The {@link Intent} that Primer will fire\n * when Primer will not show its screens (ex. already logged in)\n */\n @Override\n protected Intent getDidNotPresentIntent() {\n return new Intent(this, NativeOnboardingActivity.class);\n }\n\n /**\n * @return - The resource ID of the layout to use for the splash screen.\n */\n @Override\n protected int getSplashLayoutResId() {\n return R.layout.splash;\n }\n \n /**\n * Return true if this is the very first time this user has launched\n * your app. Return false if the user has already launched your app.\n */\n @Override\n protected boolean isFirstTimeStart() {\n return mPreferences.contains(\"started_app_before\");\n }\n}", "language": "java" } ] } [/block] Don't forget to add this new Activity to your app's Manifest.xml file. - All of our layouts are optimized for Portrait only. Lock the orientation to `portrait` only. - There should only be one instance of this Activity in a task, so configure the `launchMode` to `singleTask` - We provide a custom Theme for this Activity which assist the presentation of our screens. This is not required, and you can duplicate it and edit if you desire. - Make sure that the Activity does not declare noHistory == true The configuration below will place Primer as the launch Activity. [block:code] { "codes": [ { "code": "<activity android:name=\".LaunchActivity\"\n android:launchMode=\"singleTask\"\n android:screenOrientation=\"portrait\"\n android:theme=\"@style/PrimerFull\"\n android:label=\"YOUR_APP_LABEL\"\n android:noHistory=\"false\"\n android:windowSoftInputMode=\"adjustPan\">\n <intent-filter>\n <action android:name=\"android.intent.action.MAIN\"/>\n <category android:name=\"android.intent.category.LAUNCHER\"/>\n </intent-filter>\n</activity>", "language": "xml" } ] } [/block] [block:callout] { "type": "info", "body": "Be sure to audit your MAIN and LAUNCHER intent filters when adding this Activity to your manifest. (Ensure you only want one launcher Activity.) Also ensure that you property refactor any install events or other things that were driven by your previous launch activity. \n\nAlso ensure that the launch mode is singleTask." } [/block] [block:api-header] { "title": "Flows Launched!" } [/block] Build and run your application to see the automatic Primer onboarding experience! You can design and edit your flows easily on the Dashboard. Because our flow will only show the very first time the app is launched, you should clear your app data every time you want to see the Primer experience. [block:callout] { "type": "warning", "body": "Go to the Dashboard and ensure that your organic flow is currently running. If it isn't, no flow will appear on initialization.", "title": "Not seeing anything appear?" } [/block]