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

首頁 > 學院 > 開發設計 > 正文

firebase推送 修改系統默認notification樣式(稀有)

2019-11-09 18:42:09
字體:
來源:轉載
供稿:網友

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

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

下一篇:源代碼之Git團隊開發

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 南和县| 和硕县| 凤冈县| 鄱阳县| 射洪县| 万年县| 辽阳县| 汉中市| 中卫市| 桐城市| 仙桃市| 蒲江县| 皮山县| 盐边县| 启东市| 昌黎县| 铜梁县| 丰宁| 安塞县| 如东县| 喜德县| 农安县| 桃源县| 通州区| 长岭县| 武汉市| 赤城县| 桦南县| 广州市| 綦江县| 孟州市| 龙海市| 绥中县| 武清区| 白银市| 陇川县| 尖扎县| 西乌珠穆沁旗| 迭部县| 瑞昌市| 定安县|