android - Firebase onMessageRecieved() is not being called -


i trying implement firebase push notifications in android application. have followed firebase documentation accordingly, works fine, onrefreshtoken() being called when try send notification using firebase console, it shows completed can't see logs in android studio. sure 'onmessagerecieved' not being called.

androidmanifest.xml:

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" package="app.user.oshyerllc"> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_coarse_location" /> <uses-permission android:name="android.permission.access_fine_location" />  <application     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"     tools:node="replace">     <meta-data         android:name="com.facebook.sdk.applicationid"         android:value="@string/facebook_app_id" />     <meta-data         android:name="com.google.android.gms.version"         android:value="@integer/google_play_services_version" />     <meta-data         android:name="com.google.android.geo.api_key"         android:value="aizasybf-y05iet2_uyowtznkmdjyzxgqkzvcp8" />      <activity android:name="app.user.oshyerllc.mainactivity">         <intent-filter>             <action android:name="android.intent.action.main" />              <category android:name="android.intent.category.launcher" />         </intent-filter>     </activity>     <activity android:name="app.user.oshyerllc.otpverificationactivity" />     <activity android:name="app.user.oshyerllc.createprofileactivity" />     <activity android:name="app.user.oshyerllc.loginactivity" />     <activity android:name="app.user.oshyerllc.createprofilesocialactivity" />     <activity android:name="app.user.oshyerllc.socialotpverificationacitvity" />     <activity android:name="app.user.oshyerllc.mapactivity" />     <activity         android:name="com.google.android.gms.auth.api.signin.internal.signinhubactivity"         android:screenorientation="portrait"         android:windowsoftinputmode="statealwayshidden|adjustpan" />      <service android:name=".oshyermessagingservice">         <intent-filter>             <action android:name="com.google.firebase.messaging_event"/>         </intent-filter>      </service>      <service android:name=".oshyerinstanceidservice">         <intent-filter>             <action android:name="com.google.firebase.instance_id_event"/>         </intent-filter>     </service>   </application> 

oshyermessagingservice.java (inside main package)

package app.user.oshyerllc;   import android.util.log;    import com.google.firebase.messaging.firebasemessagingservice; import com.google.firebase.messaging.remotemessage;  public class oshyermessagingservice extends firebasemessagingservice {      private static final string tag = "oshyermessagingservice";      @override     public void onmessagereceived(remotemessage remotemessage) {              log.d(tag,"message recieved");      } } 

oshyerinstanceidservice.java:

package app.user.oshyerllc;  import android.util.log;  import com.google.firebase.iid.firebaseinstanceid; import com.google.firebase.iid.firebaseinstanceidservice;  public class oshyerinstanceidservice extends firebaseinstanceidservice {      private static final string tag = "oshyerinstanceidservice";      @override     public void ontokenrefresh() {         string refreshedtoken = firebaseinstanceid.getinstance().gettoken();         log.d(tag, "refreshed token: " + refreshedtoken);     } } 

it's not throwing me error's. havent through of questions related above issue on stackoverflow. apreciated. thank you.

onmessagereceived provided message types, following exceptions:

  1. notification messages delivered when app in background. in case, notification delivered device’s system tray. user tap on notification opens app launcher default.

  2. messages both notification , data payload, both background , foreground. in case, notification delivered device’s system tray, , data payload delivered in extras of intent of launcher activity. link

your notification sent system tray. , onmessagereceived method called when application foreground


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -