From one year, I have been working over IOT product and the application attached was working fine. Now I am not able to accept call programmatically in higher versions of an
It is sort of hack, you can use accessibility service to receive call. To enable accessibility service, you must enable your service on Setting - Accessibility - Your service.
First, add typeWindowContentChanged to accessibilityEventTypes.
And do something with event or "displayed text" or "contents description".
@Override
public void onAccessibilityEvent(AccessibilityEvent event) {
// Do something with Click or Focused event
final int eventType = event.getEventType();
String eventText = null;
switch(eventType) {
case AccessibilityEvent.TYPE_VIEW_CLICKED:
eventText = "Focused: ";
break;
case AccessibilityEvent.TYPE_VIEW_FOCUSED:
eventText = "Focused: ";
break;
}
eventText = eventText + event.getContentDescription();
// Traverse all items in screen.
// Do something with text.
AccessibilityNodeInfo info = getRootInActiveWindow();
int index;
int count = info.getChildCount();
AccessibilityNodeInfo child;
for (index = 0; index < count; index++) {
child = info.getChild(index);
if (child.getText() != null)
Log.d(TAG, "text: " + child.getText().toString() + " " + child.getContentDescription());
// perform Click
//if (child.isClickable());
//child.performAction(AccessibilityNodeInfo.ACTION_CLICK);
}
}
Yes, I know this is not a graceful way to solve your problem. It is a kind of hack.