I\'m trying to integrate AWS SNS push services with FCM in my Android app.
When I\'m trying to send a push message through SNS online console, I get this error log:
First you should apply the google-services plugin after the dependency block not in it. Also I'm not seeing any dependency that is adding FirebaseInstanceID so I'm not sure why that error is showing up. Also using FCM and GCM together is not a good idea since you have multiple receivers for the same message. Use one or the other. That could be why the sns messages are not being received.
Adding firebase messaging dependency worked for me
implementation 'com.google.firebase:firebase-analytics:17.0.1'
implementation 'com.google.firebase:firebase-messaging:19.0.1'
Please note that firebase-messaging have a dependency on firebase-analytics
add 'implementation'com.google.firebase:firebase-messaging:17.4.0'
in to your app level build.gradle file in dependency section.
dependencies {
implementation 'com.google.firebase:firebase-core:16.0.7'
implementation 'com.google.firebase:firebase-database:16.1.0'
implementation'com.google.firebase:firebase-messaging:17.4.0'
}
If you have tried all other solutions and still getting the error then try forcefully trying it... add the below code to your code where you asked for the service or getting map synced.
inside Oncreate try adding:
if(ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(yourActivity.this, Manifest.permission.ACCESS_COARSE_LOCATION)!= PackageManager.PERMISSION_GRANTED) {
ActivityCompat.requestPermissions(yourActivity.this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, LOCATION_REQUEST_CODE);
}
else{
mapFragment.getMapAsync(this);
}
and inside onConnected method try adding.
if(ActivityCompat.checkSelfPermission(this, android.Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED && ActivityCompat.checkSelfPermission(yourActivity.this, Manifest.permission.ACCESS_COARSE_LOCATION)!= PackageManager.PERMISSION_GRANTED)
{
ActivityCompat.requestPermissions(youractivity.this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION},LOCATION_REQUEST_CODE );
}