| Hey Davide Bizzarri I don't know if I did something different but I don't get the problem. Here is the step by step I did. 0. Check the Cordova version
cordova -v
9.0.0 (cordova-lib@9.0.1)
1. Create the project
cordova create $APP_FOLDER $APP_PACKAGE "$APP_NAME"
cd $APP_FOLDER
2. Add plugins / libraries
cordova plugin add cordova-plugin-device
cordova plugin add @aerogear/cordova-plugin-aerogear-push
npm i @aerogear/app
npm i @aerogear/push
npm i webpack --save-dev
npm i webpack-cli --save-dev
3. Add resource-file on config.xml inside of <platform name="android">
<resource-file src="google-services.json" target="app/google-services.json" />
4. Provides the google-services.json 5. Create a webpack.config.js
const path = require('path');
module.exports = {
mode: 'development',
entry: './src/index.js',
output: {
filename: 'index.js',
path: path.resolve(__dirname, 'www/js')
}
};
6. Provides the mobile-config.json 7. Run the webpack
./node_modules/webpack/bin/webpack.js
8. Adding Cordova platforms
cordova platform add android
9. Build the app
10. Check the AndroidManifest.xml
cat platforms/android/app/src/main/AndroidManifest.xml
<?xml version='1.0' encoding='utf-8'?>
<manifest android:hardwareAccelerated="true" android:versionCode="10000" android:versionName="1.0.0" package="org.aerogear.helloworldpush.testing" xmlns:android="http:>
<supports-screens android:anyDensity="true" android:largeScreens="true" android:normalScreens="true" android:resizeable="true" android:smallScreens="true" android:xlargeScreens="true" />
<uses-permission android:name="android.permission.INTERNET" />
<application android:hardwareAccelerated="true" android:icon="@mipmap/ic_launcher" android:label="@string/app_name" android:supportsRtl="true" android:usesCleartextTraffic="true">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale" android:label="@string/activity_name" android:launchMode="singleTop" android:name="MainActivity" android:theme="@android:style/Theme.DeviceDefault.NoActionBar" android:windowSoftInputMode="adjustResize">
<intent-filter android:label="@string/launcher_name">
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:exported="true" android:name="com.adobe.phonegap.push.PushHandlerActivity" android:permission="${applicationId}.permission.PushHandlerActivity" />
<receiver android:name="com.adobe.phonegap.push.BackgroundActionButtonHandler" />
<receiver android:name="com.adobe.phonegap.push.PushDismissedHandler" />
<service android:name="com.adobe.phonegap.push.FCMService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
<service android:name="com.adobe.phonegap.push.PushInstanceIDListenerService">
<intent-filter>
<action android:name="com.google.firebase.INSTANCE_ID_EVENT" />
</intent-filter>
</service>
</application>
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.VIBRATE" />
</manifest>
|