Code example for AccessibilityEvent

Methods: getEventType, getPackageName, getParcelableData

0
	 * @see android.accessibilityservice.AccessibilityService#onAccessibilityEvent(android.view.accessibility.AccessibilityEvent) 
	 */ 
	@Override 
	public void onAccessibilityEvent(AccessibilityEvent event) 
	{ 
	    if (event.getEventType() == AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED) 
	    { 
	    	// get notification shown 
	    	Notification notification = (Notification)event.getParcelableData();
	    	 
	    	if (notification != null)
	    	{    	 
		    	// now parse the specific packages we support 
		    	// start with GTalk 
		    	if (event.getPackageName().toString().compareTo("com.google.android.talk") == 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);		    	
		    	} 
		    	// anything from Spotify? 
		    	if (event.getPackageName().toString().compareTo("com.spotify.mobile.android.ui") == 0)
		    	{ 
			        // now broadcast the capturing of the accessibility service to the handler	    		 
		    		// anything delivered? 
		    		if (notification.tickerText != null)
		    		{