Denedim ve whatsapp çağrısı düğmesini tıklatıp bitir düğmesi tıklatma eylemlerini yakalayabiliyorum. Aşağıda bir tost mesajı ve biz olacak çekilebilir için numara gösterdi gelmiş Yukarıdaki kodda Android Developers website
public class MyAccessibilityService extends AccessibilityService {
@Override
protected void onServiceConnected() {
AccessibilityServiceInfo info = new AccessibilityServiceInfo();
// Set the type of events that this service wants to listen to. Others
// won't be passed to this service.
info.eventTypes = AccessibilityEvent.TYPE_VIEW_CLICKED |
AccessibilityEvent.TYPE_VIEW_FOCUSED;
// If you only want this service to work with specific applications, set their
// package names here. Otherwise, when the service is activated, it will listen
// to events from all applications.
info.packageNames = new String[]
{"com.whatsapp","com.android.calendar"};
// Set the type of feedback your service will provide.
info.feedbackType = AccessibilityServiceInfo.FEEDBACK_SPOKEN;
// Default services are invoked only if no package-specific ones are present
// for the type of AccessibilityEvent generated. This service *is*
// application-specific, so the flag isn't necessary. If this was a
// general-purpose service, it would be worth considering setting the
// DEFAULT flag.
// info.flags = AccessibilityServiceInfo.DEFAULT;
info.notificationTimeout = 100;
this.setServiceInfo(info);
}
@Override
public void onAccessibilityEvent(AccessibilityEvent 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();
// Do something nifty with this text, like speak the composed string
// back to the user.
Toast.makeText(getApplicationContext(),""+eventText +" --- "+event.getContentDescription(),Toast.LENGTH_LONG).show();
}
@Override
public void onInterrupt() {
}
}
mevcut örnek daha basit kullandığım AccessibilityService ve bu fazla farklıdır "Talkback" erişilebilirlik modundayken sistem tarafından kullanılabilecek contentDescription öğesinin sağlanması. Bu yardımcı olur umarım!!!
UI'nin davranışları söz konusu olduğunda, neyin davranışları hakkında doğruladınız? – JoxTraex
Whatsapp'tan belirli bir Metni yakalamak için Erişilebilirlik Hizmetini kullanmayı denedim, ancak Arama düğmesi metne değil, çizilebilir. Onun da bir problemi Yani whatsapp çağrısı başladığında ve bittiğinde bilgi almak için başka bir yol olup olmadığını arıyordum? –
Kullanıcı whatsapp actionbar içinde arama simgesini tıkladığında bilmek ister misiniz? – Dinash