我正在使用AppCenter Push将通知发送到我的Xamarin.Forms(iOS和Android)应用程序。我已成功收到通知。但是,在Android上,当应用程序处于后台时,即使我从手机设置中打开了震动,手机也不会震动。 iOS既有声音又有振动。
我遵循了https://docs.microsoft.com/en-us/appcenter/sdk/push/xamarin-forms并实现了如下所示的有效负载。
{
"notification_target": {
"type": "devices_target",
"devices": [
"XXX",
"YYY"
]
},
"notification_content": {
"name": "default",
"title": "",
"body": "ABC",
"sound":"default",
"custom_data": {
"Title": "",
"Message": "ZZZ",
"badge": "100",
"sound": "default"
}
}
}
这是我的清单
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.xxx.yyy" android:installLocation="auto" android:versionCode="78" android:versionName="5.0.4">
<uses-sdk android:minSdkVersion="19" android:targetSdkVersion="28" />
<application android:label="ParentsApp" android:name="android.support.multidex.MultiDexApplication" android:icon="@drawable/logo_1024">
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/notification_icon" />
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/red" />
</application>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="com.xxx.yyy.permission.C2D_MESSAGE" />
<permission android:protectionLevel="signature" android:name="com.xxx.yyy.permission.C2D_MESSAGE" />
</manifest>
iOS-得到声音和振动
Android-获得默认声音但没有振动
我是否可以为Android添加一些内容?谢谢。