I have followed a tutorial (https://docs.microsoft.com/en-us/azure/notification-hubs/notification-hubs-android-push-notification-google-fcm-get-started) for setting up push notifications on Android.
I'm able to successfully register to the notification (as requested in Adding code -> 15).
The problem is that when I go to the azure notification hub and perform a "Test Send" for the Android platform, the "Outcome" result is "The Token obtained from the Token Provider is wrong". I can not figure why this is the case.
I'm not able to put a break point on my android app and see where the message is received either. I have created a class extending FirebaseMessagingService
and overrode public void onMessageReceived(RemoteMessage remoteMessage)
but this never seems to get hit.
I cannot determine where, how or why this error is being returned from.
EDIT:
App Gradle
apply plugin: 'com.android.application'
android {
signingConfigs {
config {
keyAlias 'xxx'
keyPassword 'xxx'
storeFile file('../Keys/dev-release.jks')
storePassword 'xxx'
}
}
compileSdkVersion 27
defaultConfig {
applicationId "xxx"
minSdkVersion 21
targetSdkVersion 27
versionCode 9
versionName "0.09"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
multiDexEnabled true
}
// REF: https://michiganlabs.com/2014/09/23/string-constants-generated-gradle-build-configurations/
buildTypes {
release {
/*debuggable true*/
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
signingConfig signingConfigs.config
buildConfigField("String", "GOOGLE_ANALYTICS_TRACKING_ID", "\"xxx\"")
}
debug {
buildConfigField("String", "GOOGLE_ANALYTICS_TRACKING_ID", "\"xxx\"")
}
}
}
allprojects {
repositories {
maven { url "https://jitpack.io" }
maven { url 'https://maven.google.com' }
maven { url "http://dl.bintray.com/microsoftazuremobile/SDK" }
}
}
ext.support_version = '27.1.1'
ext.lifecycle_version = '1.1.1'
ext.firebase_version = '15.0.2'
ext.glide_version = '4.7.1'
ext.smart_tab_layout_version = '1.6.1'
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.github.warkiz.widget:indicatorseekbar:1.2.9'
implementation 'joda-time:joda-time:2.9.9'
implementation 'com.github.PierfrancescoSoffritti:AndroidYouTubePlayer:6.0.0'
implementation 'com.thoughtbot:expandablerecyclerview:1.4'
implementation 'com.github.PhilJay:MPAndroidChart:v3.0.3'
implementation 'com.oguzdev:CircularFloatingActionMenu:1.0.2'
implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.mindorks:placeholderview:0.7.3'
implementation 'com.yarolegovich:discrete-scrollview:1.4.7'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation 'com.facebook.android:facebook-login:4.33.0'
implementation 'com.google.code.gson:gson:2.8.2'
implementation 'com.microsoft.azure:azure-mobile-android:3.4.0@aar'
implementation 'com.microsoft.azure:notification-hubs-android-sdk:0.4@aar'
implementation 'com.microsoft.azure:azure-notifications-handler:1.0.1@aar'
implementation 'com.google.guava:guava:25.0-android'
implementation 'com.daimajia.swipelayout:library:1.2.0@aar'
implementation 'com.alexvasilkov:gesture-views:2.5.2'
implementation 'com.google.zxing:core:3.3.2'
implementation 'com.journeyapps:zxing-android-embedded:3.6.0@aar'
implementation 'me.dm7.barcodescanner:zxing:1.9.8'
implementation 'com.squareup.okhttp3:okhttp:3.10.0' // 'com.squareup.okhttp:okhttp:2.7.5'
implementation 'com.squareup.okhttp:okhttp-urlconnection:2.2.0' // REF: https://github.com/square/okhttp/issues/879
implementation 'com.squareup.mimecraft:mimecraft:1.1.1'
implementation "com.ogaclejapan.smarttablayout:library:$smart_tab_layout_version@aar"
implementation "com.ogaclejapan.smarttablayout:utils-v4:$smart_tab_layout_version@aar"
// REF: https://developers.google.com/cloud-messaging/android/android-migrate-fcm
implementation 'com.google.android.gms:play-services-gcm:15.0.1'
implementation "com.google.firebase:firebase-messaging:17.0.0"
implementation "com.google.android.gms:play-services-analytics:16.0.0"
implementation "com.google.firebase:firebase-core:16.0.0"
implementation 'com.firebase:firebase-jobdispatcher:0.8.5'
implementation "com.android.support:cardview-v7:$support_version"
implementation "com.android.support:animated-vector-drawable:$support_version"
implementation "com.android.support:design:$support_version"
implementation "com.android.support:customtabs:$support_version"
implementation "com.android.support:exifinterface:$support_version"
implementation "com.android.support:appcompat-v7:$support_version"
implementation "com.android.support:design:$support_version"
implementation "com.android.support:support-v4:$support_version"
implementation "com.android.support:recyclerview-v7:$support_version"
implementation "com.android.support:support-v4:$support_version"
implementation 'com.android.support.constraint:constraint-layout:1.1.0'
annotationProcessor "android.arch.lifecycle:compiler:$lifecycle_version"
implementation "android.arch.lifecycle:extensions:$lifecycle_version"
annotationProcessor "com.github.bumptech.glide:compiler:$glide_version"
implementation "com.github.bumptech.glide:glide:$glide_version"
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
testImplementation 'junit:junit:4.12'
}
apply plugin: 'com.google.gms.google-services'
Project Gradle
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.1.2'
classpath 'com.google.gms:google-services:3.3.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
allprojects {
repositories {
google()
jcenter()
maven {
url "https://maven.google.com" // Google's Maven repository
}
}
}
task clean(type: Delete) {
delete rootProject.buildDir
}