Problem
Your Android application may be rejected by the Google Play Store for using permissions related to VoIP calls (e.g., FOREGROUND_SERVICE_PHONE_CALL, MANAGE_OWN_CALLS) after integrating the Pushwoosh Cordova plugin.
Cause
Starting from version 8.3.40, the Pushwoosh Cordova plugin includes a module for VoIP-style call notifications, which automatically adds these permissions to your app's AndroidManifest.xml.
Solution
If you do not use the VoIP push notification functionality, you can resolve this issue by preventing these permissions from being added to your app. Here are two methods to achieve this:
Method 1: Use a Plugin Version Without the VoIP Module
The simplest solution is to use a plugin version prior to the introduction of the VoIP module, such as 8.3.39.
Pin the plugin version: In your
package.jsonfile, set the exact version forpushwoosh-cordova-plugin. Make sure to remove any characters like^or~to prevent automatic updates to a newer version."pushwoosh-cordova-plugin": "8.3.39"Perform a clean rebuild: Delete your
node_modulesfolder and theplatformsfolder, then reinstall your dependencies and rebuild your application to ensure the changes are applied correctly.
Method 2: Manually Remove Permissions via config.xml
If you need to use a newer version of the plugin but still want to exclude the VoIP functionality, you can add rules to your config.xml to remove the specific permissions and services during the build process.
Edit
config.xml: Add the following configuration within the<platform name="android">tag of your project'sconfig.xmlfile.<platform name="android"> <!-- Add tools namespace to the manifest --> <edit-config file="app/src/main/AndroidManifest.xml" target="/manifest" mode="merge"> <manifest xmlns:tools="http://schemas.android.com/tools" /> </edit-config> <!-- Remove foreground service and VoIP-related permissions --> <config-file target="app/src/main/AndroidManifest.xml" parent="/manifest"> <uses-permission android:name="android.permission.FOREGROUND_SERVICE" tools:node="remove" /> <uses-permission android:name="android.permission.FOREGROUND_SERVICE_PHONE_CALL" tools:node="remove" /> <uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT" tools:node="remove" /> <uses-permission android:name="android.permission.MANAGE_OWN_CALLS" tools:node="remove" /> <uses-permission android:name="android.permission.READ_PHONE_NUMBERS" tools:node="remove" /> </config-file> <!-- Remove the VoIP service --> <config-file target="app/src/main/AndroidManifest.xml" parent="/manifest/application"> <service android:name="com.pushwoosh.calls.service.PushwooshCallService" tools:node="remove" /> </config-file> </platform>Rebuild your app: Run
cordova build android --release.Verify (Optional): You can double-check that the permissions have been removed by inspecting the final manifest file located at
platforms/android/app/build/intermediates/merged_manifests/release/AndroidManifest.xml.
Comments
0 comments
Please sign in to leave a comment.