最近开发需求:可穿戴设备将其电量传给手机,让其电量信息显示在andorid 手机标题栏上,并且不消失,也不要向qq似得提示消息。
查看资料发现除了root修改系统应用,只能通过通过Notification让其显示在标题栏上。
具体代码如下:
private void showBetteryNotification(int powerLevel){
NotificationManager notificationManager = (NotificationManager)
mContext.getSystemService(android.content.Context.NOTIFICATION_SERVICE);
String currentBettery=mContext.getResources().getString(R.string.current_power)+":"+powerLevel;
Notification.Builder builder= new Notification.Builder(mContext);
CharSequence content