Code example for AccessibilityEvent

Methods: getEventType, getPackageName, getParcelableData

0
	boolean started = true;
	 
	@Override 
	public void onAccessibilityEvent(AccessibilityEvent event) 
	{ 
		System.out.println("AIRS:NotificationAccessibility: Got event = " + String.valueOf(event.getEventType()));
	    if (event.getEventType() == AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED) 
	    { 
	    	// get notification shown 
	    	Notification notification = (Notification)event.getParcelableData();
			System.out.println("AIRS:NotificationAccessibility: Got event");
	    	 
	    	// now parse the specific packages we support 
	    	// start with GTalk 
	    	if (event.getPackageName().toString().compareTo("com.google.android.gsf") == 0)
	    	{ 
		        // now broadcast the capturing of the accessibility service to the handler 
				Intent intent = new Intent("com.airs.accessibility");
				intent.putExtra("NotifyText", "gtalk::" + notification.tickerText);		
				sendBroadcast(intent);		    	
	    	} 
	    	 
	    	// anything from Skype? 
	    	if (event.getPackageName().toString().compareTo("com.skype.raider") == 0)
	    	{ 
		        // now broadcast the capturing of the accessibility service to the handler 
				Intent intent = new Intent("com.airs.accessibility");
				intent.putExtra("NotifyText", "skype::Message from " + notification.tickerText);		
				sendBroadcast(intent);