1

Im trying to integrate fcm in my instant app but it dosnt works.

I have 4 manifest files : /app /base /module1 /module2

The APP manifest only contains this code:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.stackoverflow.app"/>

In the base manifest is declared my application and my configuration for push notifications.

Any idea whats going wrong?

Pablo Cegarra
  • 20,955
  • 12
  • 92
  • 110

2 Answers2

4

Instant Apps don't support push notifications currently. In Google I/O 2018, a Beta program for selected Instant Apps to enable notifications was announced: https://www.youtube.com/watch?v=tXqat1JOmS8&feature=youtu.be&t=743

Hassan Ibraheem
  • 2,329
  • 1
  • 17
  • 23
  • Im trying to use the same code for the instant app and the normal app, Can I use notifications using this code or I need to refactor all or start a new project to use its without instant? – Pablo Cegarra May 13 '18 at 18:07
  • 2
    There are multiple options you can look at. If these are totally independent components, you can just move them to `app` module, then they won't be part of your Instant App, or you can just wrap your code in isInstantApp(): https://developer.android.com/topic/google-play-instant/reference#isinstantapp , you could also use flavors, so you'd have an "installed" and "instant" flavor in base module, to separate certain features. – Hassan Ibraheem May 13 '18 at 18:14
  • @HassanIbraheem, I am running into trouble trying to send a push notification to my instant app: https://stackoverflow.com/questions/63609372/firebase-messaging-not-working-in-modern-android-instant-app-displaynotificati Do you know if the beta program is still active two years later? The link to the beta program https://g.co/instantappsnotifications still works so I submitted an application... – ScottyB Aug 29 '20 at 15:09
  • related answer: https://stackoverflow.com/a/63747546/9017295 – Torkel Velure Sep 18 '20 at 12:34
0

Instant apps still do not support push notifications in 2023. They are able to generate FCM registration token, launch services and foreground services, but the problem is that the generated token is rejected with HTTP 400 when you try to use it. Once you install the same app as a regular app it works fine with no code or configuration changes.

  • Is there any chance that PWA can be used as a workaround to push notifications for instant apps? – sean May 18 '23 at 03:46