我已经尝试了很多解决方案来创建频道,但是当它在Oreo设备中收到时我仍然没有收到通知内容.通知声音即将到来,但通知抽屉中没有实际通知.
以下是我现有的代码.
public class SendNotificationTask extends AsyncTask<Void, Void, Void> {
private static final long DEFAULT_VIBRATION = 300L;
private Context mContext;
private Bundle bundle;
private SharedPreferences sharedPreferences;
private Boolean mIsForeground;
String title;
public SendNotificationTask(Context context, SharedPreferences sharedPreferences, Boolean mIsForeground, Bundle bundle){
this.mContext = context;
this.bundle = bundle;
this.sharedPreferences = sharedPreferences;
this.mIsForeground = mIsForeground;
}
protected Void doInBackground(Void... params) {
try {
String intentClassName = getMainActivityClassName();
if (intentClassName == null) {
return null;
}
if (bundle.getString("body") == null) {
return null;
} …Run Code Online (Sandbox Code Playgroud) android android-notifications firebase-cloud-messaging android-8.0-oreo