Troubleshooting
In this page you'll learn what are the most common mistakes when implementing the Notificare library for Cordova.
Switching to Production
While Android doesn't require any additional steps to ensure the development settings work in production, when you're using a single Firebase app, iOS does require different configurations. Therefore, it's recommended you always set up at least two environments in your app and at Notificare, Development and Production.
Always check if the correct NotificareServices.plist
is being included in your app. Whenever you build your app directly from Xcode in a device you will be using APNS sandbox servers, so the app keys must target a Notificare DEV application. If you archive your application for Ad Hoc, App Store or Enterprise distribution you should make sure the app keys target a Notificare PROD application. Failing to set this correctly will prevent Notificare from sending notifications to the correct device tokens, since you will be registering invalid device tokens in Notificare.
Notifications not opening from the lock screen
There are cases when Cordova's edit-config
breaks the recreation of the AndroidManifest
, and intent filters from plugins are not added to the resulting manifest.
In our context, the most noticeable feature to break is opening a notification from the lock screen. Since the RemoteMessageOpened
intent filter is not declared, the application cannot process the intent.
To work around this issue, either avoid using edit-config
or do a clean cordova platform add android
.
The two common use cases for using edit-config
have alternative solutions.
- To set the
launchMode
, you can use a preference instead.
<platform name="android">
<preference name="AndroidLaunchMode" value="singleTask" />
</platform>
- To set the
exported
flag to support Android, update your Cordova dependency to 10.1.2, which includes the necessary flag by default.
Overall, ensure the generated AndroidManifest
contains the following intent filter.
<activity android:name=".MainActivity" android:launchMode="singleTask">
<intent-filter>
<action android:name="re.notifica.intent.action.RemoteMessageOpened" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</activity>
Notification Service Extension
Including the NotificareNotificationServiceExtensionKit
via Cocoapods works as expected when you use use_frameworks!
in your Podfile
.
However, including the library as dynamic linking results in two possible errors:
- The application fails to build when the library is added to the application target but not to the extension target;
- Or the lock screen image doesn't show when the library is only added to the extension target, which doesn't get embedded in the application.
As it currently stands, Cocoapods cannot correctly add the XCFramework as a dynamically linked framework when declared in both targets. To work around this issue, we recommend using Swift Package Manager to include NotificareNotificationServiceExtensionKit
in the application.
Additional native troubleshooting
For more information on common issues when integrating the native part of our library, please take a look at the native SDKs documentation.