notification arrives in bluestack apk emulator, but does not generate notification on smartphone firebase android studio

Viewed 10

notification arrives in bluestack apk emulator, but does not generate notification on smartphone

I have the following code, the notification works normally on the bluestack emulator, but on the samsung smartphone there is no notification, I don't know if it's the device or if I have to declare something in the manifest. I don't think so, because in the emulate it generates notification normally and in the cell it does not generate notification: IS IT MY CELL PHONE CONFIGURATION?

super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    mRootRef = FirebaseDatabase.getInstance().getReference();
    builder = new NotificationCompat.Builder(this);
    mRootRef.addChildEventListener(new ChildEventListener() {
        @Override
        public void onChildAdded(DataSnapshot dataSnapshot, String s) {
            builder.setSmallIcon(R.mipmap.ic_launcher);
            builder.setContentTitle("Firebase Push Notification");
            builder.setContentText("Hello this is a test Firebase notification, a new database child has been added");
            NotificationManager notificationManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);
            notificationManager.notify(1, builder.build());
        }

        @Override
        public void onChildChanged(DataSnapshot dataSnapshot, String s) {

        }

        @Override
        public void onChildRemoved(DataSnapshot dataSnapshot) {

        }



        @Override
        public void onChildMoved(DataSnapshot dataSnapshot, String s) {

        }

        @Override
        public void onCancelled(DatabaseError databaseError) {

        }
    });

HOW DO I PUT A SOUND IN THE NOTIFICATION IN THIS CODE?

0 Answers
Related