0

firebase 메시징을 사용하여 푸시 알림을 보내고 있습니다. Google Play 서비스 (버전 3.2.25)가 설치되어있는 Android 버전 4.1.2를 실행하는 기기를 사용하여 테스트했는데 작동하면 onMessageReceived이 올바르게 호출됩니다. 그러나 Android 2.3.6 및 마지막 Google Play 서비스 (설치해야 함)를 실행하는 기기를 사용하여 테스트하려고하면 Firebase 웹 UI에 성공적으로 전송되었다고 표시 되더라도 메시지가 도착하지 않습니다.Firebase Messaging이 Android 2.3.6에서 작동하지 않습니다.

그래서 이전 버전의 Google Play 서비스를 사용하는 최신 Android에서 9.4.0 버전을 사용한다고 명시되어 있고 다른 시나리오에서 작동하지 않는 이유는 무엇인가요?

Build.gradle (응용 프로그램)

apply plugin: 'com.android.application' 

android { 

    compileSdkVersion 24 
    buildToolsVersion "24.0.2" 

    defaultConfig { 
     applicationId "com.example.sipas" 
     minSdkVersion 10 
     targetSdkVersion 24 
    } 

    buildTypes { 
     release { 
      minifyEnabled true 
      shrinkResources true 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 

} 

dependencies { 
    compile 'com.android.support:support-v4:24.2.0' 
    compile 'org.greenrobot:eventbus:3.0.0' 
    compile 'me.dm7.barcodescanner:zbar:1.9' 
    compile 'com.google.code.gson:gson:2.4' 
    compile 'com.jakewharton:disklrucache:2.0.2' 
    compile 'com.squareup.okhttp3:okhttp:3.4.1' 
    compile 'com.squareup.okio:okio:1.9.0' 
    compile 'com.birbit:android-priority-jobqueue:2.0.0' 
    compile 'org.jetbrains:annotations-java5:15.0' 
    compile 'com.google.android.gms:play-services-gcm:9.4.0' 
    compile 'com.google.firebase:firebase-core:9.4.0' 
    compile 'com.google.firebase:firebase-messaging:9.4.0' 
} 

apply plugin: 'com.google.gms.google-services' 

Build.gradle (프로젝트)

buildscript { 
    repositories { 
     jcenter() 
    } 
    dependencies { 
     classpath 'com.android.tools.build:gradle:2.1.3' 
     classpath 'com.google.gms:google-services:3.0.0' 
    } 
} 

allprojects { 
    repositories { 
     jcenter() 
    } 
} 
+0

FWIW - Play Services 9.4.52를 사용하여 2.3.6을 실행하는 이전 장치에서 Firebase 콘솔에서 보낸 알림을 수신 할 수있었습니다. Firebase 9.4.0을 사용하여 테스트 애플리케이션을 빌드합니다. 휴대 전화에 아주 오래된 버전의 Play Services가 있기 때문에 초기 시도가 실패했습니다. 사용중인 Play 서비스 버전은 무엇입니까? –

+0

마지막 버전을 설치했습니다. 어쩌면 내 장치와 호환되지 않을 수도 있지만, 설치 한 후에 getToken 메서드가 토큰을 반환하기 시작했기 때문에 그럴 수 없다고 생각합니다. –

+0

그래서 토큰을 받고 있지만 메시지를받지 못하고 있습니까? 귀하의 질문에 당신이 아닌 경우에 사용하고있는 gradle 종속성을 추가 할 수 있습니까? FCM은 SDK 9에서 작동해야합니다. 따라서 2.3.6이 문제가되어서는 안됩니다. –

답변

0

나는 같은 문제가 컴파일 'com.google.gms을 제거하려고했다 : google-services : 9.4.0 'from build.gradle 및 모든 푸시 알림은 모든 휴대 전화에서 아주 잘 작동합니다!

+1

'classpath'com.google.gms : google-services : 3.0.0 ''이라고 말한 것과 일치하는 유일한 행은 문서가 필요하다고 말합니다 : [https://firebase.google.com/docs] /android/setup](https://firebase.google.com/docs/android/setup) –

관련 문제