国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 學(xué)院 > 開發(fā)設(shè)計 > 正文

firebase推送 修改系統(tǒng)默認(rèn)notification樣式(稀有)

2019-11-09 17:38:46
字體:
供稿:網(wǎng)友

firebase在app前臺時執(zhí)行onMessageReceived方法,可以自定義樣式,但是在app后臺或被殺死時,不執(zhí)行onMessageReceived方法,所以需要重寫firebase的zzm方法才可以更改系統(tǒng)的默認(rèn)樣式

public class MyNotificationService extends FirebaseMessagingService {

public void onMessageReceived(RemoteMessage remoteMessage) { // do nothing}@Overridepublic void zzm(Intent intent) { Intent launchIntent = new Intent(this, SplashScreenActivity.class); launchIntent.setAction(Intent.ACTION_MAIN); launchIntent.addCategory(Intent.CATEGORY_LAUNCHER); PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 /* R equest code */, launchIntent, PendingIntent.FLAG_ONE_SHOT); Bitmap rawBitmap = BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher); NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_notification) .setLargeIcon(rawBitmap) .setContentTitle(intent.getStringExtra("gcm.notification.title")) .setContentText(intent.getStringExtra("gcm.notification.body")) .setAutoCancel(true) .setContentIntent(pendingIntent); NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(0 /* ID of notification */, notificationBuilder.build());}

}


上一篇:抓包Fidder

下一篇:keytool生成密鑰

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 迁安市| 佛冈县| 桦甸市| 昭通市| 专栏| 桂平市| 衢州市| 射洪县| 鸡泽县| 佛坪县| 进贤县| 乌鲁木齐县| 吉木萨尔县| 乐平市| 德惠市| 迁西县| 黄龙县| 个旧市| 襄城县| 阳江市| 沁阳市| 桃园市| 抚顺县| 都兰县| 灯塔市| 泸州市| 吴旗县| 太保市| 中超| 海兴县| 若尔盖县| 琼中| 渭南市| 射洪县| 长汀县| 山西省| 五常市| 楚雄市| 都匀市| 龙陵县| 都匀市|