几个月后,我将在ionic / cordova中尝试应用程序项目。之前,推送通知在android和ios上都可以使用,但是现在只有在iOS和Android应用程序上,推送通知才能在收到通知时始终崩溃。
来自android studio的Logcat信息(当应用程序处于后台时):
java.lang.NoSuchMethodError:没有虚拟方法setChannelId(Ljava / lang / String;)Landroid / support / v4 / app / NotificationCompat $ Builder;在类Landroid / support / v4 / app / NotificationCompat $ Builder ...
在此处输入代码
当应用程序处于焦点状态时,收到通知但未显示。
我尝试更改插件版本,但没有任何改变。
config.xml:
<engine name="android" spec="6.4.0"/>
<engine name="ios" spec="4.5.4"/>
<plugin name="cordova-plugin-googlemaps" spec="2.2.9">
<variable name="API_KEY_FOR_ANDROID" value="(api_key)"/>
<variable name="API_KEY_FOR_IOS" value="(api_key)"/>
<variable name="PLAY_SERVICES_VERSION" value="+"/>
<variable name="ANDROID_SUPPORT_V4_VERSION" value="27.1.0"/>
<variable name="LOCATION_WHEN_IN_USE_DESCRIPTION"
value="This app wants to get your location while this app runs only."/>
<variable name="LOCATION_ALWAYS_USAGE_DESCRIPTION"
value="This app wants to get your location always, even this app runs in background."/>
</plugin>
<plugin name="phonegap-plugin-barcodescanner" spec="^6.0.8">
<variable name="CAMERA_USAGE_DESCRIPTION" value=" "/>
</plugin>
<plugin name="cordova-plugin-console" spec="^1.1.0"/>
<plugin name="cordova-plugin-device" spec="^1.1.7"/>
<plugin name="cordova-plugin-splashscreen" spec="^4.1.0"/>
<plugin name="cordova-plugin-statusbar" spec="^2.4.2"/>
<plugin name="cordova-plugin-whitelist" spec="^1.3.3"/>
<plugin name="ionic-plugin-keyboard" spec="^2.2.1"/>
<plugin name="cordova-plugin-nativestorage" spec="^2.3.1"/>
<plugin name="cordova-plugin-file-opener2" spec="^2.0.19"/>
<plugin name="cordova-plugin-file" spec="^4.3.3"/>
<plugin name="cordova-plugin-inappbrowser" spec="^1.7.2"/>
<plugin name="cordova-plugin-camera" spec="^2.4.1">
<variable name="CAMERA_USAGE_DESCRIPTION" value=" "/>
<variable name="PHOTOLIBRARY_USAGE_DESCRIPTION" value=" "/>
</plugin>
<plugin name="ionic-plugin-deeplinks" spec="^1.0.15">
<variable name="URL_SCHEME" value="(url_scheme)"/>
<variable name="DEEPLINK_SCHEME" value="(scheme)"/>
<variable name="DEEPLINK_HOST" value="(host)"/>
<variable name="ANDROID_PATH_PREFIX" value="/"/>
<variable name="ANDROID_2_PATH_PREFIX" value="/"/>
<variable name="ANDROID_3_PATH_PREFIX" value="/"/>
<variable name="ANDROID_4_PATH_PREFIX" value="/"/>
<variable name="ANDROID_5_PATH_PREFIX" value="/"/>
<variable name="DEEPLINK_2_SCHEME" value=" "/>
<variable name="DEEPLINK_2_HOST" value=" "/>
<variable name="DEEPLINK_3_SCHEME" value=" "/>
<variable name="DEEPLINK_3_HOST" value=" "/>
<variable name="DEEPLINK_4_SCHEME" value=" "/>
<variable name="DEEPLINK_4_HOST" value=" "/>
<variable name="DEEPLINK_5_SCHEME" value=" "/>
<variable name="DEEPLINK_5_HOST" value=" "/>
</plugin>
<plugin name="cordova.plugins.diagnostic" spec="^3.9.2"/>
<plugin name="cordova-plugin-google-analytics" spec="^1.8.3"/>
<plugin name="cordova-plugin-firebase" spec="0.1.24"/>
<plugin name="cordova-plugin-dialogs" spec="^1.3.4"/>
<plugin name="cordova-plugin-network-information" spec="^1.3.4"/>
<plugin name="cordova-plugin-app-version" spec="^0.1.9"/>
<plugin name="cordova-plugin-ionic-webview" spec="1.2.0"/>
<plugin name="de.appplant.cordova.plugin.local-notification" spec="^0.8.5"/>
<plugin name="com.telerik.plugins.nativepagetransitions" spec="^0.6.5"/>
<plugin name="cordova-plugin-decimal-keyboard-wkwebview" spec="^1.0.4"/>