{"__v":148,"_id":"551ef4f04986f62b00a72076","category":{"__v":5,"_id":"551ef4ef4986f62b00a72035","pages":["551ef4f04986f62b00a72070","551ef4f04986f62b00a72071","551ef4f04986f62b00a72072","551ef4f04986f62b00a72073","551ef4f04986f62b00a72074","551ef4f04986f62b00a72075","551ef4f04986f62b00a72076","5522fc40b4a0de0d00de7f24","5524353371c0542100993567","5553aabaeac63f0d003e6c28","55f719077b40090d007a8004"],"project":"542b6018044e1e2200413772","version":"551ef4ef4986f62b00a7202e","reference":false,"createdAt":"2014-10-20T19:30:50.610Z","from_sync":false,"order":2,"slug":"android","title":"Android"},"parentDoc":null,"project":"542b6018044e1e2200413772","user":"54455ea0a21e4d140055dc08","version":{"__v":7,"_id":"551ef4ef4986f62b00a7202e","forked_from":"542b6018044e1e2200413775","project":"542b6018044e1e2200413772","createdAt":"2015-04-03T20:15:43.149Z","releaseDate":"2015-04-03T20:15:43.149Z","categories":["551ef4ef4986f62b00a7202f","551ef4ef4986f62b00a72030","551ef4ef4986f62b00a72031","551ef4ef4986f62b00a72032","551ef4ef4986f62b00a72033","551ef4ef4986f62b00a72034","551ef4ef4986f62b00a72035","551ef4ef4986f62b00a72036","551ef4ef4986f62b00a72037","551ef4ef4986f62b00a72038","551ef4ef4986f62b00a72039","551ef4ef4986f62b00a7203a","551ef4ef4986f62b00a7203b","551ef4ef4986f62b00a7203c","551ef4ef4986f62b00a7203d","551ef4ef4986f62b00a7203e","55d7f1879510f00d007ec727","56b94a5a9fc0de1700b60ae9","56bd0e48ac1c5c1900b2dbe4","56d74afc3eb4dd0b0020196a","5723ab8a1f41110e003081ed","576b4dd327d6252b00085422"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"2.0.0","version":"2.0"},"updates":[],"createdAt":"2015-03-09T23:58:05.709Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":5,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Small Notification Icon\"\n}\n[/block]\nBy default, Our SDK automatically uses your App's launcher icon.  However, we highly recommend following our instructions to create custom icons for the following reasons:\n   - Since the app icon is too large, it will get cropped when the ticker text is showing on the status bar though Android does scale the icon down to fit after the ticker text is done displaying.\n   - [Android's Notification Icon Standards](http://developer.android.com/design/style/iconography.html#notification) notes your small notification icon should be all white (grey on Android 2.3).\n   - Starting with Android 5, the OS forces the notification icon to be all white when your app targets Android API 21+. If you don't make a correct small icon, it will most likely be displayed as a solid white square or circle in the status bar.\n\nTo quickly and easily generate small icons with the correct settings, we recommend using the [Android Asset Studio](http://romannurik.github.io/AndroidAssetStudio/icons-notification.html). Use `ic_stat_onesignal_default` as the name. Download and extract the res folder contents to your project and send out some test notifications to make sure it is working.\n[block:html]\n{\n  \"html\": \"<br>\"\n}\n[/block]\nIf you prefer to not use the Android Asset Studio please make your icon files in the following locations and sizes:\n###### Android 3.0 and higher.\nThese icons are expected to be entirely white.\n- `res/drawable-mdpi-v11/ic_stat_onesignal_default.png` 24x24 pixels\n- `res/drawable-hdpi-v11/ic_stat_onesignal_default.png` 36x36 pixels\n- `res/drawable-xhdpi-v11/ic_stat_onesignal_default.png` 48x48 pixels\n- `res/drawable-xxhdpi-v11/ic_stat_onesignal_default.png` 72x72 pixels\n\n###### Android 2.3 devices.\nThese icons are expected to be [grey(#828282 to #919191)](http://web.archive.org/web/20121025153046/http://developer.android.com/guide/practices/ui_guidelines/icon_design_status_bar.html#icon9).\n- `res/drawable-mdpi/ic_stat_onesignal_default.png` 24x24 pixels\n- `res/drawable-hdpi/ic_stat_onesignal_default.png` 36x36 pixels\n- `res/drawable-xhdpi/ic_stat_onesignal_default.png` 48x48 pixels\n- `res/drawable-xxhdpi/ic_stat_onesignal_default.png` 72x72 pixels\n[block:html]\n{\n  \"html\": \"<br>\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Large Notification Icon\"\n}\n[/block]\nThe large notification icon will show up to the left of the notification text on Android 3.0 and newer devices. If you do not set a large icon, the small icon will be used instead. If you want a default icon to be used, name it `ic_onesignal_large_icon_default` *(keeping the file extension)* and place it in the `res/drawable-xxhdpi-v11/` folder or in the root of your assets folder. You only need one icon file at 192x192 pixels as we will auto scale the image for you to prevent it from being cropped. You can also supply a URL where the icon will be displayed from.\n[block:html]\n{\n  \"html\": \"<br>\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Action Buttons\"\n}\n[/block]\nAndroid 4.1 and newer devices support actions buttons. You can specify up to 3 buttons that will display below your notification content. The button id is added to the additionalData variable in the notification opened callback. See the SDK API documentation for more details on looking for the id.\n\n###### Button Icons\nBy default icons will not display on the action buttons. If you're adding buttons to your notifications we highly recommend adding icons to them. You will need to make your icons 32x32dp (24x24dp optical square) in size, this means the following pixel sizes:\n```\nmdpi = 24x24 pixels in a 32x32 area\nhdpi = 36x36 pixels in a 48x48 area\nxhdpi = 48x48 pixels in a 64x64 area\nxxhdpi = 72x72 pixels in a 96x96 area\n```\n*See the image 'Big Picture' sample below to see what actions buttons look like on a notification.*\n<br>\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Big Picture\"\n}\n[/block]\nAndroid 4.1 and newer devices support a big picture that will show below your notification text when it is expanded. It can be located in your drawable folders, your assets folder in your app, or it can be loaded remotely from a server with a URL.\n\nThe image should be a 2:1 aspect ratio otherwise Android will crop your image. Android not have a size limit however see our recommended minimum, balanced, and maximum sizes below.\n* Minimum - 400x200\n* Balanced - 800x400\n* Maximum - 1440x720\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://www.filepicker.io/api/file/57TxqxYQS5ySZZaPAxYe\",\n        \"AndroidActionButtonsImageLinks-1.png\",\n        \"800\",\n        \"292\",\n        \"#438ed9\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n\n[block:html]\n{\n  \"html\": \"<br><br>\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Notification Stacking\"\n}\n[/block]\nSimply enter any value in the “Group Key” option in the Android message settings to have your notifications stack. Notifications with the same group key will automatically stack on the device.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://www.filepicker.io/api/file/ZwvB3F4bRqepRE03huzU\",\n        \"stacked_notification.png\",\n        \"900\",\n        \"460\",\n        \"#886865\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n- *Stacking works on all our latest SDKs and on Android devices all the way back to Android 2.3.*\n- *Also works on Amazon devices, set the group key listed under the amazon settings as well.*\n<br><br>\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"App Icon Badge counts\"\n}\n[/block]\nThe OneSignal SDK automatically sets the badge count on your app to the number of notifications that are currently in the notification shade. If you want to disable this you can add the following to your `AndroidManifest.xml`.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<application ...>\\n   <meta-data android:name=\\\"com.onesignal.BadgeCount\\\" android:value=\\\"DISABLE\\\" />\\n</application>\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\n<br>\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Notification Sounds\"\n}\n[/block]\nBy default OneSignal automatically plays the default system notification sound. If you would like a custom one to always play instead, place a sound file in `res/raw/` and name it onesignal_default_sound *(keeping the file extension)*. You can use .wav, .mp3. or .ogg. If you would like to change the notification sound per notification you can add any other sound files in `res/raw` and include it's resource name (omit the file extension) in the sound field when sending the notification.\n\nIf you're having issues with the sound not playing, make sure that it is getting built into your APK by extracting it and make sure it is located in `res/raw/`.\n[block:html]\n{\n  \"html\": \"<br><br>\"\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Background Data and Notification Overriding\"\n}\n[/block]\nOneSignal supports sending additional data along with a notification as key value pairs. You can read this additional data when a notification is opened or one comes in when your app is in use already by adding a [NotificationOpenedHandler](android-sdk-api#NotificationOpenedHandler) instead.\n\nHowever if you want to one of the following continue with the instructions below.\n* Receive data in the background with or without displaying a notification.\n* Override specific notification settings depending on client side app logic such as custom accent color, vibration pattern, or other any other `NotificationCompat` options available.\n\n<br>\n**1.**  Add the following to your `AndroidManifest.xml`.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<service\\n   android:name=\\\".YOUR_CLASS_NAME\\\"\\n   android:exported=\\\"false\\\">\\n   <intent-filter>\\n      <action android:name=\\\"com.onesignal.NotificationExtender\\\" />\\n   </intent-filter>\\n</service>\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\n<br>\n**2.** Create a class that extents `NotificationExtenderService` and implement the `onNotificationProcessing` method.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"import com.onesignal.OSNotificationPayload;\\nimport com.onesignal.NotificationExtenderService;\\n\\npublic class NotificationExtenderBareBonesExample extends NotificationExtenderService {\\n   :::at:::Override\\n   protected boolean onNotificationProcessing(OSNotificationPayload notification) {\\n     \\t// Read properties from notification.\\n     \\n      // Return true to stop the notifications from displaying.\\n      return false;\\n   }\\n}\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n<br>\n**3.** To override or extend specific notification properties call `displayNotification` with `OverrideSettings`.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"import android.support.v4.app.NotificationCompat;\\n\\nimport com.onesignal.OSNotificationPayload;\\nimport com.onesignal.NotificationExtenderService;\\n\\nimport java.math.BigInteger;\\n\\npublic class NotificationExtenderExample extends NotificationExtenderService {\\n   @Override\\n   protected boolean onNotificationProcessing(OSNotificationPayload notification) {\\n      OverrideSettings overrideSettings = new OverrideSettings();\\n      overrideSettings.extender = new NotificationCompat.Extender() {\\n         @Override\\n         public NotificationCompat.Builder extend(NotificationCompat.Builder builder) {\\n            // Sets the background notification color to Green on Android 5.0+ devices.\\n            return builder.setColor(new BigInteger(\\\"FF00FF00\\\", 16).intValue());\\n         }\\n      };\\n\\n      OSNotificationDisplayedResult result = displayNotification(overrideSettings);\\n\\t\\t\\tLog.d(\\\"OneSignalExample\\\", \\\"Notification displayed with id: \\\" + result.notificationId);\\n\\n      return true;\\n   }\\n}\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n**Additional Notes**\n`NotificationExtenderService` is an Android `IntentService` so please do all your work synchronously. A wake lock is obtained so the device will not sleep while you're processing the payload. \n\n<br><br>\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Resume last Activity when opening a Notification\"\n}\n[/block]\nAdd the following code to the top of `onCreate` in your launcher `Activity`.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"private static boolean activityStarted;\\n\\n@Override\\nprotected void onCreate(Bundle savedInstanceState) {\\n  super.onCreate(savedInstanceState);\\n\\n  if (   activityStarted\\n      && getIntent() != null\\n      && (getIntent().getFlags() & Intent.FLAG_ACTIVITY_REORDER_TO_FRONT) != 0) {\\n  \\tfinish();\\n  \\treturn;\\n  }\\n  \\n  activityStarted = true;\\n}\",\n      \"language\": \"java\"\n    }\n  ]\n}\n[/block]\n**Additional information:** By default OneSignal calls `startActivity` with the following intent flags.\n```\nIntent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK\n```\n<br><br>\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Changing the open action of a notification\"\n}\n[/block]\nBy default OneSignal will open or resume your launcher Activity when a notification is tapped on. You can disable this behavior by adding the meta-data tag `com.onesignal.NotificationOpened.DEFAULT` set to `DISABLE` inside your application tag in your `AndroidManifest.xml`.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<application ...>\\n   <meta-data android:name=\\\"com.onesignal.NotificationOpened.DEFAULT\\\" android:value=\\\"DISABLE\\\" />\\n</application>\",\n      \"language\": \"xml\"\n    }\n  ]\n}\n[/block]\n*Make sure you have `NotificationOpenedHandler` in the `onCreate` method in your `Application` class to get the notification data. See [4. Add Optional NotificationOpenedHandler](https://documentation.onesignal.com/docs/android-studio-sdk-installation#4-add-optional-notificationopenedhandler) for insturctions on setting this up.*\n<br><br>\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Example Project\"\n}\n[/block]\nWe have an example project with a custom sound, small icon, large icon, and a background data BroadcastReceiver [you can look at for reference.](https://github.com/one-signal/OneSignal-Android-SDK/tree/master/Examples)\n<br>\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Android SDK API Reference\"\n}\n[/block]\nSee our [Android SDK API Reference](https://documentation.onesignal.com/docs/android-sdk-api) for more customizations.","excerpt":"We highly recommend following at least our Small Notification Icon instructions below.","slug":"android-notification-customizations","type":"basic","title":"Customizing Notifications"}

Customizing Notifications

We highly recommend following at least our Small Notification Icon instructions below.

[block:api-header] { "type": "basic", "title": "Small Notification Icon" } [/block] By default, Our SDK automatically uses your App's launcher icon. However, we highly recommend following our instructions to create custom icons for the following reasons: - Since the app icon is too large, it will get cropped when the ticker text is showing on the status bar though Android does scale the icon down to fit after the ticker text is done displaying. - [Android's Notification Icon Standards](http://developer.android.com/design/style/iconography.html#notification) notes your small notification icon should be all white (grey on Android 2.3). - Starting with Android 5, the OS forces the notification icon to be all white when your app targets Android API 21+. If you don't make a correct small icon, it will most likely be displayed as a solid white square or circle in the status bar. To quickly and easily generate small icons with the correct settings, we recommend using the [Android Asset Studio](http://romannurik.github.io/AndroidAssetStudio/icons-notification.html). Use `ic_stat_onesignal_default` as the name. Download and extract the res folder contents to your project and send out some test notifications to make sure it is working. [block:html] { "html": "<br>" } [/block] If you prefer to not use the Android Asset Studio please make your icon files in the following locations and sizes: ###### Android 3.0 and higher. These icons are expected to be entirely white. - `res/drawable-mdpi-v11/ic_stat_onesignal_default.png` 24x24 pixels - `res/drawable-hdpi-v11/ic_stat_onesignal_default.png` 36x36 pixels - `res/drawable-xhdpi-v11/ic_stat_onesignal_default.png` 48x48 pixels - `res/drawable-xxhdpi-v11/ic_stat_onesignal_default.png` 72x72 pixels ###### Android 2.3 devices. These icons are expected to be [grey(#828282 to #919191)](http://web.archive.org/web/20121025153046/http://developer.android.com/guide/practices/ui_guidelines/icon_design_status_bar.html#icon9). - `res/drawable-mdpi/ic_stat_onesignal_default.png` 24x24 pixels - `res/drawable-hdpi/ic_stat_onesignal_default.png` 36x36 pixels - `res/drawable-xhdpi/ic_stat_onesignal_default.png` 48x48 pixels - `res/drawable-xxhdpi/ic_stat_onesignal_default.png` 72x72 pixels [block:html] { "html": "<br>" } [/block] [block:api-header] { "type": "basic", "title": "Large Notification Icon" } [/block] The large notification icon will show up to the left of the notification text on Android 3.0 and newer devices. If you do not set a large icon, the small icon will be used instead. If you want a default icon to be used, name it `ic_onesignal_large_icon_default` *(keeping the file extension)* and place it in the `res/drawable-xxhdpi-v11/` folder or in the root of your assets folder. You only need one icon file at 192x192 pixels as we will auto scale the image for you to prevent it from being cropped. You can also supply a URL where the icon will be displayed from. [block:html] { "html": "<br>" } [/block] [block:api-header] { "type": "basic", "title": "Action Buttons" } [/block] Android 4.1 and newer devices support actions buttons. You can specify up to 3 buttons that will display below your notification content. The button id is added to the additionalData variable in the notification opened callback. See the SDK API documentation for more details on looking for the id. ###### Button Icons By default icons will not display on the action buttons. If you're adding buttons to your notifications we highly recommend adding icons to them. You will need to make your icons 32x32dp (24x24dp optical square) in size, this means the following pixel sizes: ``` mdpi = 24x24 pixels in a 32x32 area hdpi = 36x36 pixels in a 48x48 area xhdpi = 48x48 pixels in a 64x64 area xxhdpi = 72x72 pixels in a 96x96 area ``` *See the image 'Big Picture' sample below to see what actions buttons look like on a notification.* <br> [block:api-header] { "type": "basic", "title": "Big Picture" } [/block] Android 4.1 and newer devices support a big picture that will show below your notification text when it is expanded. It can be located in your drawable folders, your assets folder in your app, or it can be loaded remotely from a server with a URL. The image should be a 2:1 aspect ratio otherwise Android will crop your image. Android not have a size limit however see our recommended minimum, balanced, and maximum sizes below. * Minimum - 400x200 * Balanced - 800x400 * Maximum - 1440x720 [block:image] { "images": [ { "image": [ "https://www.filepicker.io/api/file/57TxqxYQS5ySZZaPAxYe", "AndroidActionButtonsImageLinks-1.png", "800", "292", "#438ed9", "" ] } ] } [/block] [block:html] { "html": "<br><br>" } [/block] [block:api-header] { "type": "basic", "title": "Notification Stacking" } [/block] Simply enter any value in the “Group Key” option in the Android message settings to have your notifications stack. Notifications with the same group key will automatically stack on the device. [block:image] { "images": [ { "image": [ "https://www.filepicker.io/api/file/ZwvB3F4bRqepRE03huzU", "stacked_notification.png", "900", "460", "#886865", "" ] } ] } [/block] - *Stacking works on all our latest SDKs and on Android devices all the way back to Android 2.3.* - *Also works on Amazon devices, set the group key listed under the amazon settings as well.* <br><br> [block:api-header] { "type": "basic", "title": "App Icon Badge counts" } [/block] The OneSignal SDK automatically sets the badge count on your app to the number of notifications that are currently in the notification shade. If you want to disable this you can add the following to your `AndroidManifest.xml`. [block:code] { "codes": [ { "code": "<application ...>\n <meta-data android:name=\"com.onesignal.BadgeCount\" android:value=\"DISABLE\" />\n</application>", "language": "xml" } ] } [/block] <br> [block:api-header] { "type": "basic", "title": "Notification Sounds" } [/block] By default OneSignal automatically plays the default system notification sound. If you would like a custom one to always play instead, place a sound file in `res/raw/` and name it onesignal_default_sound *(keeping the file extension)*. You can use .wav, .mp3. or .ogg. If you would like to change the notification sound per notification you can add any other sound files in `res/raw` and include it's resource name (omit the file extension) in the sound field when sending the notification. If you're having issues with the sound not playing, make sure that it is getting built into your APK by extracting it and make sure it is located in `res/raw/`. [block:html] { "html": "<br><br>" } [/block] [block:api-header] { "type": "basic", "title": "Background Data and Notification Overriding" } [/block] OneSignal supports sending additional data along with a notification as key value pairs. You can read this additional data when a notification is opened or one comes in when your app is in use already by adding a [NotificationOpenedHandler](android-sdk-api#NotificationOpenedHandler) instead. However if you want to one of the following continue with the instructions below. * Receive data in the background with or without displaying a notification. * Override specific notification settings depending on client side app logic such as custom accent color, vibration pattern, or other any other `NotificationCompat` options available. <br> **1.** Add the following to your `AndroidManifest.xml`. [block:code] { "codes": [ { "code": "<service\n android:name=\".YOUR_CLASS_NAME\"\n android:exported=\"false\">\n <intent-filter>\n <action android:name=\"com.onesignal.NotificationExtender\" />\n </intent-filter>\n</service>", "language": "xml" } ] } [/block] <br> **2.** Create a class that extents `NotificationExtenderService` and implement the `onNotificationProcessing` method. [block:code] { "codes": [ { "code": "import com.onesignal.OSNotificationPayload;\nimport com.onesignal.NotificationExtenderService;\n\npublic class NotificationExtenderBareBonesExample extends NotificationExtenderService {\n @Override\n protected boolean onNotificationProcessing(OSNotificationPayload notification) {\n \t// Read properties from notification.\n \n // Return true to stop the notifications from displaying.\n return false;\n }\n}", "language": "java" } ] } [/block] <br> **3.** To override or extend specific notification properties call `displayNotification` with `OverrideSettings`. [block:code] { "codes": [ { "code": "import android.support.v4.app.NotificationCompat;\n\nimport com.onesignal.OSNotificationPayload;\nimport com.onesignal.NotificationExtenderService;\n\nimport java.math.BigInteger;\n\npublic class NotificationExtenderExample extends NotificationExtenderService {\n @Override\n protected boolean onNotificationProcessing(OSNotificationPayload notification) {\n OverrideSettings overrideSettings = new OverrideSettings();\n overrideSettings.extender = new NotificationCompat.Extender() {\n @Override\n public NotificationCompat.Builder extend(NotificationCompat.Builder builder) {\n // Sets the background notification color to Green on Android 5.0+ devices.\n return builder.setColor(new BigInteger(\"FF00FF00\", 16).intValue());\n }\n };\n\n OSNotificationDisplayedResult result = displayNotification(overrideSettings);\n\t\t\tLog.d(\"OneSignalExample\", \"Notification displayed with id: \" + result.notificationId);\n\n return true;\n }\n}", "language": "java" } ] } [/block] **Additional Notes** `NotificationExtenderService` is an Android `IntentService` so please do all your work synchronously. A wake lock is obtained so the device will not sleep while you're processing the payload. <br><br> [block:api-header] { "type": "basic", "title": "Resume last Activity when opening a Notification" } [/block] Add the following code to the top of `onCreate` in your launcher `Activity`. [block:code] { "codes": [ { "code": "private static boolean activityStarted;\n\n@Override\nprotected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n\n if ( activityStarted\n && getIntent() != null\n && (getIntent().getFlags() & Intent.FLAG_ACTIVITY_REORDER_TO_FRONT) != 0) {\n \tfinish();\n \treturn;\n }\n \n activityStarted = true;\n}", "language": "java" } ] } [/block] **Additional information:** By default OneSignal calls `startActivity` with the following intent flags. ``` Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_NEW_TASK ``` <br><br> [block:api-header] { "type": "basic", "title": "Changing the open action of a notification" } [/block] By default OneSignal will open or resume your launcher Activity when a notification is tapped on. You can disable this behavior by adding the meta-data tag `com.onesignal.NotificationOpened.DEFAULT` set to `DISABLE` inside your application tag in your `AndroidManifest.xml`. [block:code] { "codes": [ { "code": "<application ...>\n <meta-data android:name=\"com.onesignal.NotificationOpened.DEFAULT\" android:value=\"DISABLE\" />\n</application>", "language": "xml" } ] } [/block] *Make sure you have `NotificationOpenedHandler` in the `onCreate` method in your `Application` class to get the notification data. See [4. Add Optional NotificationOpenedHandler](https://documentation.onesignal.com/docs/android-studio-sdk-installation#4-add-optional-notificationopenedhandler) for insturctions on setting this up.* <br><br> [block:api-header] { "type": "basic", "title": "Example Project" } [/block] We have an example project with a custom sound, small icon, large icon, and a background data BroadcastReceiver [you can look at for reference.](https://github.com/one-signal/OneSignal-Android-SDK/tree/master/Examples) <br> [block:api-header] { "type": "basic", "title": "Android SDK API Reference" } [/block] See our [Android SDK API Reference](https://documentation.onesignal.com/docs/android-sdk-api) for more customizations.