我在我的Android应用程序中使用FCM来管理推送通知.当应用程序处于前台并且应用程序图标也可见(正确)时,它完全正常工作.但是当应用程序在后台运行时,我没有正确收到通知.而不是透明图标,它显示白色方形图标作为通知图标.我知道,FCM会自动处理后台操作.但我需要显示我的应用程序图标而不是那个白色图标.注意:我只使用透明图标.我也试过下面的编码
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/rt_transparent_icon" />
<meta-data android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@android:color/holo_blue_bright" />
Run Code Online (Sandbox Code Playgroud)
但是这些解决方案都没有对我有用.谁能告诉我该怎么做?
android firebase firebase-cloud-messaging firebase-notifications
我有一个json链接,如果我们打开它,我会得到以下结果
{
"Status": "Success",
"All_Details": [{
"Types": "0",
"TotalPoints": "0",
"ExpiringToday": 0
}],
"First": [{
"id": "0",
"ImagePath": "http://first.example.png"
}],
"Second": [{
"id": "2",
"ImagePath": "http://second.example.png"
}],
"Third": [{
"id": "3",
"ImagePath": "http://third.example.png"
}],
Run Code Online (Sandbox Code Playgroud)
}
我需要的是,我想动态获取所有关键名称,如status,All_details,First等.
我还想在All_details和First Array中获取数据.我使用以下方法
@Override
public void onResponse(JSONObject response) throws JSONException {
VolleyLog.d(TAG, "Home Central OnResponse: " + response);
String statusStr = response.getString("Status");
Log.d(TAG, "Status: " + statusStr);
if (statusStr.equalsIgnoreCase("Success")) {
Iterator iterator = response.keys();
while (iterator.hasNext()) {
String key = (String)iterator.next();
}
}
}
Run Code Online (Sandbox Code Playgroud)
我得到了存储在String键中的所有键名.但是我无法打开获取JSON数组中的值,例如.我需要使用String(Key)获取第一个和第二个数组中的值.我怎样才能做到这一点.???