Advertisement
Guest User

Untitled

a guest
Jun 27th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.28 KB | None | 0 0
  1. android {
  2. compileSdkVersion 28
  3. defaultConfig {
  4. applicationId "com.myproject"
  5. minSdkVersion 18
  6. targetSdkVersion 28
  7. versionCode 423
  8. versionName "2.1.423"
  9.  
  10. def AAVersion = '4.5.2'
  11.  
  12. dependencies {
  13. annotationProcessor "org.androidannotations:androidannotations:$AAVersion"
  14. annotationProcessor "org.androidannotations:ormlite:$AAVersion"
  15.  
  16. implementation fileTree(dir: 'libs', include: ['*.jar'])
  17.  
  18. implementation 'com.android.support.constraint:constraint-layout:1.1.3'
  19. implementation 'com.android.support:animated-vector-drawable:28.0.0'
  20. implementation 'com.android.support:appcompat-v7:28.0.0'
  21. implementation 'com.android.support:cardview-v7:28.0.0'
  22. implementation 'com.android.support:customtabs:28.0.0'
  23. implementation 'com.android.support:exifinterface:28.0.0'
  24. implementation 'com.android.support:support-media-compat:28.0.0'
  25. implementation 'com.android.support:support-v4:28.0.0'
  26.  
  27. implementation 'com.crashlytics.sdk.android:crashlytics:2.9.7'
  28. implementation 'com.google.android.gms:play-services-gcm:16.0.0'
  29. implementation 'com.google.code.gson:gson:2.8.2'
  30. implementation 'com.j256.ormlite:ormlite-android:5.1'
  31. implementation 'commons-codec:commons-codec:1.11'
  32. implementation 'commons-io:commons-io:2.6'
  33. implementation 'org.apache.commons:commons-lang3:3.8.1'
  34. implementation 'org.apache.httpcomponents:httpclient:4.3.6'
  35. implementation "org.androidannotations:androidannotations-api:$AAVersion"
  36. implementation "org.androidannotations:ormlite-api:$AAVersion"
  37.  
  38. testImplementation 'junit:junit:4.12'
  39. androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
  40. androidTestImplementation 'com.android.support.test:runner:1.0.2'
  41. }
  42.  
  43. NotificationManager notificationManager = (NotificationManager) context
  44. .getSystemService(Context.NOTIFICATION_SERVICE);
  45. // Create the NotificationChannel, but only on API 26+ because
  46. // the NotificationChannel class is new and not in the support library
  47. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
  48. CharSequence name = context.getString(R.string.channel_name);
  49. String description = context.getString(R.string.channel_description);
  50. int importance = NotificationManager.IMPORTANCE_DEFAULT;
  51. NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, name, importance);
  52. channel.setDescription(description);
  53. // Register the channel with the system; you can't change the importance
  54. // or other notification behaviors after this
  55. notificationManager.createNotificationChannel(channel);
  56. }
  57. Uri soundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
  58. if (mBuilder == null) {
  59. mBuilder = new NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID)
  60. // icon as on notification bar and on notification layout
  61. .setSmallIcon(R.drawable.ic_stat_bulb).setContentTitle(context.getString(R.string.app_name))
  62. // .setLargeIcon(largeIcon).setTicker(message).setWhen(when)
  63. .setSound(soundUri)
  64. // notification LED
  65. .setLights(0xFF0000FF, 100, 3000)
  66. // hide icon on notification bar when clicked
  67. .setAutoCancel(true);
  68. }
  69.  
  70. private void createNotificationChannel() {
  71. // Create the NotificationChannel, but only on API 26+ because
  72. // the NotificationChannel class is new and not in the support library
  73. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
  74. CharSequence name = getString(R.string.channel_name);
  75. String description = getString(R.string.channel_description);
  76. int importance = NotificationManager.IMPORTANCE_DEFAULT;
  77. NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, name, importance);
  78. channel.setDescription(description);
  79. // Register the channel with the system; you can't change the importance
  80. // or other notification behaviors after this
  81.  
  82. NotificationManager notificationManager = getSystemService(NotificationManager.class);
  83. notificationManager.createNotificationChannel(channel);
  84. }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement