我将Ionic 3与最新版本的onesignal一起使用。我的后端向我的应用发送通知。我尝试过没有成功的自定义声音通知。
首先,我创建声音并将其放入C:\ Users \ tkossoko \ Documents \ rdv-pref-app \ app \ V1 \ rdv-pref-app \ platforms \ android \ res \ raw \ onesignalsound.mp3 < / p>
在后端,我像这样发送通知
`String jsonResponse; 字符串声音=“ onesignalsound”; 字符串small_icon =“ ic_stat_onesignal_default”;
URL url = new URL("https://onesignal.com/api/v1/notifications");
HttpURLConnection con = (HttpURLConnection)url.openConnection();
con.setUseCaches(false);
con.setDoOutput(true);
con.setDoInput(true);
con.setRequestProperty("Content-Type", "application/json; charset=UTF-8");
con.setRequestMethod("POST");
String strJsonBody = "{"
+ "\"app_id\": \""+appId+"\","
+ "\"include_player_ids\": ["+idsToSend+"],"
+ "\"data\": {\"foo\": \"bar\"},"
+ "\"android_sound\": \""+sound+"\","
+ "\"small_icon\": \""+small_icon+"\","
+ "\"contents\": {\"fr\": \""+message+"\",\"en\": \""+message+"\"}"
+ "}";
` 但是我仍然具有默认的通知声音。我该怎么办? 预先感谢。