国产探花免费观看_亚洲丰满少妇自慰呻吟_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ā)表
主站蜘蛛池模板: 永修县| 江源县| 彰化市| 永安市| 阿拉善左旗| 梅河口市| 双江| 奈曼旗| 衡阳县| 嘉峪关市| 双峰县| 韶关市| 客服| 五台县| 平果县| 镇赉县| 定安县| 乌兰县| 新竹县| 光山县| 新晃| 皮山县| 宣威市| 华蓥市| 芦溪县| 永川市| 海门市| 淮安市| 教育| 闵行区| 广平县| 湟源县| 绥化市| 古浪县| 恩施市| 天柱县| 赤水市| 闻喜县| 伊宁市| 思南县| 高雄县|