Guest User

Untitled

a guest
Jan 18th, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.22 KB | None | 0 0
  1. // Top-level build file where you can add configuration options common to all sub-projects/modules.
  2.  
  3. buildscript {
  4.  
  5. repositories {
  6. google()
  7. jcenter()
  8. }
  9. dependencies {
  10. classpath 'com.android.tools.build:gradle:3.3.0'
  11. classpath 'com.google.gms:google-services:4.2.0'
  12.  
  13. // NOTE: Do not place your application dependencies here; they belong
  14. // in the individual module build.gradle files
  15. }
  16. }
  17.  
  18. allprojects {
  19. repositories {
  20. google()
  21. jcenter()
  22. }
  23. }
  24.  
  25. task clean(type: Delete) {
  26. delete rootProject.buildDir
  27. }
  28.  
  29. apply plugin: 'com.android.application'
  30. apply plugin: 'com.google.gms.google-services'
  31. com.google.gms.googleservices.GoogleServicesPlugin.config.disableVersionCheck = true
  32.  
  33. android {
  34. compileSdkVersion 28
  35. buildToolsVersion "28.0.3"
  36. defaultConfig {
  37. applicationId "com.***"
  38. minSdkVersion 19
  39. targetSdkVersion 28
  40. versionCode 1
  41. versionName "1.0"
  42. testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
  43. vectorDrawables.useSupportLibrary = true
  44. multiDexEnabled = true
  45. }
  46. buildTypes {
  47. release {
  48. minifyEnabled false
  49. proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
  50. }
  51. }
  52. }
  53.  
  54. dependencies {
  55. implementation fileTree(include: ['*.jar'], dir: 'libs')
  56. //noinspection GradleCompatible
  57. implementation 'com.android.support:appcompat-v7:28.0.0'
  58. implementation 'com.android.support:recyclerview-v7:28.0.0'
  59. implementation 'com.android.support:design:28.0.0'
  60. implementation 'com.android.support.constraint:constraint-layout:1.1.3'
  61. ...
  62. implementation('com.google.android.gms:play-services-base:16.0.1') {
  63. exclude module: 'support-v4'
  64. }
  65.  
  66. implementation('com.google.android.gms:play-services-maps:16.0.0') {
  67. exclude module: 'support-v4'
  68. }
  69.  
  70. implementation('com.google.android.gms:play-services-places:16.0.0') {
  71. exclude module: 'support-v4'
  72. }
  73. implementation 'com.google.firebase:firebase-core:16.0.6'
  74. implementation 'com.google.firebase:firebase-iid:17.0.4'
  75. implementation 'com.google.firebase:firebase-messaging:17.3.4'
  76. }
  77.  
  78. <?xml version="1.0" encoding="utf-8"?>
  79. <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  80. package="com.**">
  81.  
  82. <uses-permission android:name="android.permission.INTERNET"/>
  83.  
  84. <application
  85. android:name=".ApplicationClass"
  86. android:allowBackup="true"
  87. android:icon="@drawable/app_icon"
  88. android:label="@string/app_name"
  89. android:roundIcon="@drawable/app_icon"
  90. android:supportsRtl="true"
  91. android:theme="@style/AppTheme">
  92.  
  93. <activity
  94. android:name=".MainActivity"
  95. android:theme="@style/Theme.AppCompat.Light.NoActionBar"/>
  96.  
  97. <meta-data
  98. android:name="com.google.android.geo.API_KEY"
  99. android:value="***"/>
  100.  
  101. <activity
  102. android:name=".LoginActivity"
  103. android:theme="@style/Theme.AppCompat.Light.NoActionBar">
  104. <intent-filter>
  105. <action android:name="android.intent.action.MAIN"/>
  106.  
  107. <category android:name="android.intent.category.LAUNCHER"/>
  108. </intent-filter>
  109. </activity>
  110. <service
  111. android:name=".MyFirebaseInstanceIDService"
  112. android:enabled="true"
  113. android:exported="true">
  114. <intent-filter>
  115. <action android:name="com.google.firebase.MESSAGING_EVENT"/>
  116. </intent-filter>
  117. </service>
  118. <meta-data
  119. android:name="com.google.firebase.messaging.default_notification_icon"
  120. android:resource="@drawable/logo" />
  121. </application>
  122. </manifest>
  123.  
  124. FirebaseInstanceId.getInstance().getInstanceId().addOnSuccessListener(new OnSuccessListener<InstanceIdResult>() {
  125. @Override
  126. public void onSuccess(InstanceIdResult instanceIdResult) {
  127. refreshedToken = instanceIdResult.getToken();
  128. Log.e("refreshedToken", refreshedToken);
  129. // Do whatever you want with your token now
  130. // i.e. store it on SharedPreferences or DB
  131. // or directly send it to server
  132. }
  133. });
Add Comment
Please, Sign In to add comment