第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

嘗試在后臺(tái)/前臺(tái)運(yùn)行時(shí)應(yīng)用程序崩潰但適用于其他手機(jī)

嘗試在后臺(tái)/前臺(tái)運(yùn)行時(shí)應(yīng)用程序崩潰但適用于其他手機(jī)

qq_花開(kāi)花謝_0 2021-06-04 14:37:00
在使用 android studio 和 firebase 時(shí),我的應(yīng)用程序(在后臺(tái)或前臺(tái))在點(diǎn)擊通知時(shí)在 API 26 設(shè)備上崩潰。而當(dāng)我使用 API 23 設(shè)備時(shí),當(dāng)應(yīng)用程序關(guān)閉并單擊通知時(shí)應(yīng)用程序崩潰,但當(dāng)應(yīng)用程序處于后臺(tái)/前臺(tái)時(shí)仍可以處理通知。我不明白這個(gè)問(wèn)題,任何幫助表示贊賞。通知服務(wù)import android.app.NotificationManager;import android.app.PendingIntent;import android.content.Intent;import android.support.v4.app.NotificationCompat;import com.google.firebase.messaging.RemoteMessage;public class FirebaseMessagingService extends com.google.firebase.messaging.FirebaseMessagingService {    @Override    public void onMessageReceived(RemoteMessage remoteMessage) {        super.onMessageReceived(remoteMessage);        String notification_title = remoteMessage.getNotification().getTitle();        String notification_message = remoteMessage.getNotification().getBody();        String click_action = remoteMessage.getNotification().getClickAction();        String from_user_id = remoteMessage.getData().get("from_user_id");        NotificationCompat.Builder mBuilder =                new NotificationCompat.Builder(FirebaseMessagingService.this, "default")                        .setSmallIcon(R.mipmap.ic_launcher)                        .setContentTitle(notification_title)                        .setContentText(notification_message);        Intent resultIntent = new Intent(click_action);        resultIntent.putExtra("user_id", from_user_id);        PendingIntent resultPendingIntent =                PendingIntent.getActivity(                        FirebaseMessagingService.this,                        0,                        resultIntent,                        PendingIntent.FLAG_UPDATE_CURRENT                );        mBuilder.setContentIntent(resultPendingIntent);        int mNotificationId = (int) System.currentTimeMillis();        NotificationManager mNotifyMgr =                (NotificationManager) getSystemService(NOTIFICATION_SERVICE);        mNotifyMgr.notify(mNotificationId, mBuilder.build());    }}
查看完整描述

2 回答

?
明月笑刀無(wú)情

TA貢獻(xiàn)1828條經(jīng)驗(yàn) 獲得超4個(gè)贊

您刪除了錯(cuò)誤的大部分重要行。但是,您必須非常仔細(xì)地查看它,甚至對(duì)其進(jìn)行解碼。據(jù)說(shuō):在調(diào)用“Firebase.....child()”方法時(shí),“ProfileActivity.onCreate()”方法存在問(wèn)題。使用變量(而不是固定字符串)調(diào)用“child()”方法的行很少,因此其中之一(請(qǐng)檢查錯(cuò)誤日志并找到該“child()”警告的行)是真正的問(wèn)題。


查看完整回答
反對(duì) 回復(fù) 2021-06-10
?
開(kāi)心每一天1111

TA貢獻(xiàn)1836條經(jīng)驗(yàn) 獲得超13個(gè)贊

所以我發(fā)現(xiàn)我需要


 final String user_id;

    String data = getIntent().getStringExtra("user_id");

    if (data == null) {

        user_id = getIntent().getStringExtra("from_user_id");

    } else {

        user_id = getIntent().getStringExtra("user_id");

    }

我沒(méi)有檢查我從我的意圖中得到了什么字符串,因此出現(xiàn)了空異常。


查看完整回答
反對(duì) 回復(fù) 2021-06-10
  • 2 回答
  • 0 關(guān)注
  • 153 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)