2017-07-13 11 views
2

最後に、AndroidスタジオでFirebase Cloud Messaging Serviceを試し始めます。私はこのチュートリアルを試してみて、私はこのチュートリアルでのように正確に同じクラスを持っている: はenter link description hereFirebaseプッシュ通知は表示されません

  1. が私の最初の質問は、なぜAndroidのStudioの「Androidのモニターには」私にトークンデバイスに一度だけ表示されたのですか? Firebaseで新しいプロジェクトを開始し、それを私のAppProjektと接続して実行するたびに、Tokenは私が問題なくプロジェクトを初めて実行したときに私に示してくれました。私がもう一度それを実行する場合、私はこのトークンの何も、何も表示されません!

  2. 2番目の質問は、私がFirebaseからプッシュ通知を受け取っていない理由です。ここで

は私のAndroidのマニフェストである:ここでは

<?xml version="1.0" encoding="utf-8"?> 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.example.felixkoepping.pushtest2"> 

<uses-permission android:name="android.permission.INTERNET"/> 
<application 
    android:name="android.support.multidex.MultiDexApplication" 
    android:allowBackup="true" 
    android:icon="@mipmap/ic_launcher" 
    android:label="@string/app_name" 
    android:roundIcon="@mipmap/ic_launcher_round" 
    android:supportsRtl="true" 
    android:theme="@style/AppTheme"> 
    <activity android:name=".MainActivity"> 
     <intent-filter> 
      <action android:name="android.intent.action.MAIN" /> 

      <category android:name="android.intent.category.LAUNCHER" /> 
     </intent-filter> 
    </activity> 

    <service 
     android:name=".MyFirebaseMessagingService"> 
     <intent-filter> 
      <action android:name="com.google.firebase.MESSAGING_EVENT"/> 
     </intent-filter> 
    </service> 

    <service 
     android:name=".MyFirebaseInstanceIDService"> 
     <intent-filter> 
      <action android:name="com.google.firebase.INSTANCE_ID_EVENT"/> 
     </intent-filter> 
    </service> 
</application> 

は、アプリのセクションでGradleのファイルである:ここでは

apply plugin: 'com.android.application' 

android { 
compileSdkVersion 25 
buildToolsVersion '25.0.3' 
defaultConfig { 
    multiDexEnabled true 
    applicationId "com.example.felixkoepping.pushtest2" 
    minSdkVersion 19 
    targetSdkVersion 25 
    versionCode 1 
    versionName "1.0" 
    testInstrumentationRunner 
    "android.support.test.runner.AndroidJUnitRunner" 
} 
buildTypes { 
    release { 
     minifyEnabled false 
     proguardFiles getDefaultProguardFile('proguard-android.txt'), 
    'proguard-rules.pro' 
    } 
} 
} 

dependencies { 
    compile fileTree(include: ['*.jar'], dir: 'libs') 
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
{ 
    exclude group: 'com.android.support', module: 'support-annotations' 
}) 
compile 'com.android.support:appcompat-v7:25.3.1' 
compile 'com.android.support.constraint:constraint-layout:1.0.2' 

compile 'com.google.firebase:firebase-messaging:9.2.0' 
compile 'com.google.firebase:firebase-core:9.2.0' 
compile 'com.android.support:multidex:1.0.1' 
testCompile 'junit:junit:4.12' 
} 
apply plugin: 'com.google.gms.google-services' 

は、プロジェクトのセクションのGradleのファイルです。

Androidのモニターで唯一の「赤のメッセージ」は次のとおりです。

E/FA: Failed to send event to AppMeasurementService: 
android.os.DeadObjectException: 
com.google.android.gms.measurement.internal.zzm$zza$zza.zza(Unknown Source) 

私はFirebaseにコンソールからの通知を送信し、正確にトークンを持つこのデバイスは、何も私のエミュレータに表示されませんしている場合...

皆さん、この問題で私を助けてくれることを願っています。私はあまりを試してみましたが、何もうまくいかない...

おかげで書くためのみんな:-)

+0

こんにちはフェリックス。 "*私はそんなに試しましたが、何も働かない" *あなたは何を試してみましたか?チュートリアルに従ったことがわかりましたが、問題をデバッグするために既に行ったことを探しています。あなたもそれらを投稿すれば素晴らしいと思うので、私たちは見た目の場所を絞り込むことができます。 :) –

答えて

0

感謝。私はあなたの問題を解決し得るために、今日を支援することがあります。

  • コンソールから送信された通知は、アプリが終了しているか、バックグラウンド状態になっている場合にのみ表示されます。あなたはまだ何が起こるかを知らないなら、コメント機能、感謝を通して私にpingを実行Firebase notifications in the foreground

このリンクを参照して、フォアグラウンド状態でアプリのショーの通知を行うことが