mt2503 6260/6261BT dialer APK在 android5.0上通知异常
时间:10-02
整理:3721RD
点击:
[DESCRIPTION]
6260/6261BT dialer APK在android5.0上通知异常
[SOLUTION]
适用版本号:
BTNotification_v1.0.0.rar
BTNotification_v1.1.7.rar
BTNotification_v1.2.7.rar
BTNotification_v1.3.19.rar
APK_SmartDevice_V1.4.10.rar
APK_SmartDevice_for_BTDv3_v1.0.0.rar
关于无法获取5.0通知的问题, 需要客户自行修改代码进行修复。修改方式如下:
将文件NoficationService.java中函数private String[] getNotificationText();改为:
private String[] getNotificationText() {
RemoteViews remoteViews = mNotification.contentView;
HashMap<Integer, String> text = new HashMap<Integer, String>();
try {
Class<?> remoteViewsClass = Class.forName(RemoteViews.class.getName());
Field[] outerFields = remoteViewsClass.getDeclaredFields();
Field actionField = null;
for (Field outerField : outerFields) {
if (outerField.getName().equals("mActions")) {
actionField = outerField;
break;
}
}
if (actionField == null) {
return null;
}
actionField.setAccessible(true);
ArrayList<Object> actions = (ArrayList<Object>) actionField.get(remoteViews);
for (Object action : actions) {
/*
* Get notification tile and content
*/
Field innerFields[] = action.getClass().getDeclaredFields();
Object value = null;
Integer type = null;
int viewId = 0;
for (Field field : innerFields) {
field.setAccessible(true);
if (field.getName().equals("value")) {
value = field.get(action);
} else if (field.getName().equals("type")) {
type = field.getInt(action);
} else if (field.getName().equals("methodName")) {
String method = (String) field.get(action);
if (method.equals("setProgress")) {
return null;
}
}
}
// If this notification filed is title or content, save it to text list
if ((type != null) && ((type == NOTIFICATION_TITLE_TYPE) || (type ==
NOTIFICATION_CONTENT_TYPE))) {
if (value != null) {
viewId++;
text.put(viewId, value.toString());
}
}
}
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String[] textArray = text.values().toArray(new String[0]);
try {
//Log.i(LOG_TAG, "getNotificationText(), text list = " + Arrays.toString(textArray));
}
catch (Exception e)
{
Log.i(LOG_TAG, "getNotificationText Exception");
}
return textArray;
}
6260/6261BT dialer APK在android5.0上通知异常
[SOLUTION]
适用版本号:
BTNotification_v1.0.0.rar
BTNotification_v1.1.7.rar
BTNotification_v1.2.7.rar
BTNotification_v1.3.19.rar
APK_SmartDevice_V1.4.10.rar
APK_SmartDevice_for_BTDv3_v1.0.0.rar
关于无法获取5.0通知的问题, 需要客户自行修改代码进行修复。修改方式如下:
将文件NoficationService.java中函数private String[] getNotificationText();改为:
private String[] getNotificationText() {
RemoteViews remoteViews = mNotification.contentView;
HashMap<Integer, String> text = new HashMap<Integer, String>();
try {
Class<?> remoteViewsClass = Class.forName(RemoteViews.class.getName());
Field[] outerFields = remoteViewsClass.getDeclaredFields();
Field actionField = null;
for (Field outerField : outerFields) {
if (outerField.getName().equals("mActions")) {
actionField = outerField;
break;
}
}
if (actionField == null) {
return null;
}
actionField.setAccessible(true);
ArrayList<Object> actions = (ArrayList<Object>) actionField.get(remoteViews);
for (Object action : actions) {
/*
* Get notification tile and content
*/
Field innerFields[] = action.getClass().getDeclaredFields();
Object value = null;
Integer type = null;
int viewId = 0;
for (Field field : innerFields) {
field.setAccessible(true);
if (field.getName().equals("value")) {
value = field.get(action);
} else if (field.getName().equals("type")) {
type = field.getInt(action);
} else if (field.getName().equals("methodName")) {
String method = (String) field.get(action);
if (method.equals("setProgress")) {
return null;
}
}
}
// If this notification filed is title or content, save it to text list
if ((type != null) && ((type == NOTIFICATION_TITLE_TYPE) || (type ==
NOTIFICATION_CONTENT_TYPE))) {
if (value != null) {
viewId++;
text.put(viewId, value.toString());
}
}
}
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
String[] textArray = text.values().toArray(new String[0]);
try {
//Log.i(LOG_TAG, "getNotificationText(), text list = " + Arrays.toString(textArray));
}
catch (Exception e)
{
Log.i(LOG_TAG, "getNotificationText Exception");
}
return textArray;
}