{"_id":"5a6b684793313c005b692e0c","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"},"project":"57c87ef85754fa1700b1228d","parentDoc":null,"user":"545a811ebf1d2b0e00aaa1f2","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"},"githubsync":"","__v":0,"updates":["56f57ba8ab3f610e000a6597"],"next":{"pages":[],"description":""},"createdAt":"2015-09-15T23:40:34.851Z","link_external":false,"link_url":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":0,"body":"Follow these easy few steps to get Primer screens to appear in your app. \n\nNeed help or have questions? Don't hesitate to [Contact Us](doc:contact-us)!\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"title\": \"Demo Integration on GitHub\",\n  \"body\": \"We have provided a [demo project ](https://github.com/goprimer/Android-Primer-Demo) to use as a reference to get the SDK integrated quickly into your app.\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"1. Install the SDK\"\n}\n[/block]\nMake the following changes to your `build.gradle` file:\n\nAdd the Maven repository.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"repositories {\\n    maven { url \\\"https://github.com/goprimer/maven-repo/raw/master\\\" }\\n}\",\n      \"language\": \"groovy\"\n    }\n  ]\n}\n[/block]\nAdd the compile dependency.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"dependencies {\\n\\t  compile 'com.goprimer:primer:3.5.3'\\n}\",\n      \"language\": \"groovy\"\n    }\n  ]\n}\n[/block]\nYou should be able to build your application as usual. If you run into any issues compiling, please check the [Frequently Asked Questions](doc:sdk-faq) or reach out to us!\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"Ensure your `minSdkVersion` is 15 or higher. We recommend a `compileSdkVersion` of 23.\\nIf you compile against a lower version, you may see proguard warnings for missing methods in our library, see [Proguard's troubleshooting section](http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember).\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"2. Start the SDK\"\n}\n[/block]\nPrimer needs to be initialized in your custom `Application` object. If you don’t have an application object in your manifest, please see [this link](https://developer.android.com/reference/android/app/Application.html) to set it up. \n\nYou will need to call `Primer.init` from the `onCreate` method of this object and provide your token (you can find it in your <a href=\"http://goprimer.com/dashboard#/project//edit\" target=\"_blank\">Project Settings</a>).\n\nIn order to help you configure Primer, we provide a builder class. You will initialize Primer by passing in the `Application` object, and an instance of the `PrimerOptions` class. Here is a sample:\n\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"public class MyApplication extends Application {\\n\\n    :::at:::Override\\n    public void onCreate() {\\n        super.onCreate();\\n\\n        PrimerOptions.Builder builder = PrimerOptions.builder();\\n        builder.withToken(\\\"[[app:token]]\\\");\\n\\n        Primer.init(this, builder.build());\\n    }\\n}\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"3. Permissions\"\n}\n[/block]\nThe Primer Android SDK allows screens to request permissions from devices that are running on Marshmallow or greater (if the app was compiled against at least SDK 23). In order for Primer to successfully ask the user for a permission request, you must add the desired permissions in your app's Manifest.xml file. \n\nNote that on Android versions less than Marshmallow, these permissions will be granted at install time from the play store. More info [here](https://developer.android.com/training/permissions/requesting.html) \n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"\\n<!-- optional permissions for Primer screens-->\\n<uses-permission android:name=\\\"android.permission.RECORD_AUDIO\\\"/>\\n<uses-permission android:name=\\\"android.permission.ACCESS_FINE_LOCATION\\\"/>\\n<uses-permission android:name=\\\"android.permission.ACCESS_COARSE_LOCATION\\\"/>\\n<uses-permission android:name=\\\"android.permission.READ_CONTACTS\\\"/>\\n<uses-permission android:name=\\\"android.permission.READ_EXTERNAL_STORAGE\\\"/>\\n<uses-permission android:name=\\\"android.permission.CAMERA\\\"/>\\n\\n<!-- permission for in app billing (required for purchase screens)-->\\n<uses-permission android:name=\\\"com.android.vending.BILLING\\\"/>\\n\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\n\n[block:callout]\n{\n  \"type\": \"info\",\n  \"body\": \"Note: If your Primer flows have purchase screens, you must add the `BILLING` permission as depicted above. You also must configure your app to be able to purchase items from your google play app console. Please follow the steps [here](https://developer.android.com/google/play/billing/billing_overview.html) to implement billing in your app.\",\n  \"title\": \"In App Purchases permission\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"4. Show Primer Screens\"\n}\n[/block]\nAs you know, Android apps are a collection of Activities pieced together. The Primer experience will simply be another Activity in your application. Because our SDK provides user onboarding as one of its core features, the Activity that you create should be the first Activity that is started when users start your application. As soon as this Activity is started, we determine if conditions are met to show a Primer experience.\n\nIn order to start showing Primer screens, you simply have to start an Activity that extends from one of our abstract classes. We provide two abstract Activities that you can extend from depending on your app's requirements. (This Activity should be the default launcher activity.)\n\n- If your application requires a user to signup or login before they use your product, then you should use our  [**AbstractPrimerWithUserActivity**](doc:user_activity)\n\n- If your application should only show welcome screens the first time a user launches your app, then you should use our  [**AbstractPrimerWelcomeActivity**](doc:welcome_activity)","excerpt":"","slug":"quick-start","type":"basic","title":"Quick Start Guide"}
Follow these easy few steps to get Primer screens to appear in your app. Need help or have questions? Don't hesitate to [Contact Us](doc:contact-us)! [block:callout] { "type": "info", "title": "Demo Integration on GitHub", "body": "We have provided a [demo project ](https://github.com/goprimer/Android-Primer-Demo) to use as a reference to get the SDK integrated quickly into your app." } [/block] [block:api-header] { "type": "basic", "title": "1. Install the SDK" } [/block] Make the following changes to your `build.gradle` file: Add the Maven repository. [block:code] { "codes": [ { "code": "repositories {\n maven { url \"https://github.com/goprimer/maven-repo/raw/master\" }\n}", "language": "groovy" } ] } [/block] Add the compile dependency. [block:code] { "codes": [ { "code": "dependencies {\n\t compile 'com.goprimer:primer:3.5.3'\n}", "language": "groovy" } ] } [/block] You should be able to build your application as usual. If you run into any issues compiling, please check the [Frequently Asked Questions](doc:sdk-faq) or reach out to us! [block:callout] { "type": "info", "body": "Ensure your `minSdkVersion` is 15 or higher. We recommend a `compileSdkVersion` of 23.\nIf you compile against a lower version, you may see proguard warnings for missing methods in our library, see [Proguard's troubleshooting section](http://proguard.sourceforge.net/manual/troubleshooting.html#unresolvedlibraryclassmember)." } [/block] [block:api-header] { "type": "basic", "title": "2. Start the SDK" } [/block] Primer needs to be initialized in your custom `Application` object. If you don’t have an application object in your manifest, please see [this link](https://developer.android.com/reference/android/app/Application.html) to set it up. You will need to call `Primer.init` from the `onCreate` method of this object and provide your token (you can find it in your <a href="http://goprimer.com/dashboard#/project//edit" target="_blank">Project Settings</a>). In order to help you configure Primer, we provide a builder class. You will initialize Primer by passing in the `Application` object, and an instance of the `PrimerOptions` class. Here is a sample: [block:code] { "codes": [ { "code": "public class MyApplication extends Application {\n\n @Override\n public void onCreate() {\n super.onCreate();\n\n PrimerOptions.Builder builder = PrimerOptions.builder();\n builder.withToken(\"[[app:token]]\");\n\n Primer.init(this, builder.build());\n }\n}", "language": "java" } ] } [/block] [block:api-header] { "type": "basic", "title": "3. Permissions" } [/block] The Primer Android SDK allows screens to request permissions from devices that are running on Marshmallow or greater (if the app was compiled against at least SDK 23). In order for Primer to successfully ask the user for a permission request, you must add the desired permissions in your app's Manifest.xml file. Note that on Android versions less than Marshmallow, these permissions will be granted at install time from the play store. More info [here](https://developer.android.com/training/permissions/requesting.html) [block:code] { "codes": [ { "code": "\n<!-- optional permissions for Primer screens-->\n<uses-permission android:name=\"android.permission.RECORD_AUDIO\"/>\n<uses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\"/>\n<uses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\"/>\n<uses-permission android:name=\"android.permission.READ_CONTACTS\"/>\n<uses-permission android:name=\"android.permission.READ_EXTERNAL_STORAGE\"/>\n<uses-permission android:name=\"android.permission.CAMERA\"/>\n\n<!-- permission for in app billing (required for purchase screens)-->\n<uses-permission android:name=\"com.android.vending.BILLING\"/>\n", "language": "xml" } ] } [/block] [block:callout] { "type": "info", "body": "Note: If your Primer flows have purchase screens, you must add the `BILLING` permission as depicted above. You also must configure your app to be able to purchase items from your google play app console. Please follow the steps [here](https://developer.android.com/google/play/billing/billing_overview.html) to implement billing in your app.", "title": "In App Purchases permission" } [/block] [block:api-header] { "type": "basic", "title": "4. Show Primer Screens" } [/block] As you know, Android apps are a collection of Activities pieced together. The Primer experience will simply be another Activity in your application. Because our SDK provides user onboarding as one of its core features, the Activity that you create should be the first Activity that is started when users start your application. As soon as this Activity is started, we determine if conditions are met to show a Primer experience. In order to start showing Primer screens, you simply have to start an Activity that extends from one of our abstract classes. We provide two abstract Activities that you can extend from depending on your app's requirements. (This Activity should be the default launcher activity.) - If your application requires a user to signup or login before they use your product, then you should use our [**AbstractPrimerWithUserActivity**](doc:user_activity) - If your application should only show welcome screens the first time a user launches your app, then you should use our [**AbstractPrimerWelcomeActivity**](doc:welcome_activity)