Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development


Thank you for visiting the BlackBerry Support Community Forums.

BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)

BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.

"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."

- Kevin Michaluk, Founder, CrackBerry.com

Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.


Reply
Developer
Posts: 889
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha
My Carrier: Verizon

Unbound share invocation always invokes BBM groups

I am running into a bit of an odd issue, where an unbound share action can only share to BBM groups (not even BBM contacts, but BBM groups). This occurs when I use the following code.

 

var byteData:ByteArray = new ByteArray();
byteData.writeUTFBytes("Text to share");
var request:InvokeRequest = new InvokeRequest();
request.mimeType = "text/plain";
request.action = InvokeAction.SHARE;
request.data = byteData;
InvokeManager.invokeManager.invoke(request);

 If instead I do a bound invocation by adding the line

request.target = "Facebook"; 

 then everything works as expected. I have also tested setting the request target to "Twitter" and "sys.bbm.sharehandler" with success.

 

Does anyone have a clue as to what would cause this, or is it something I am going to have to work around?

 


Read my thoughts on BlackBerry Development at news.ebscer.com
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Unbound share invocation always invokes BBM groups

You have to query that targets for your unbounded request, display a list of choices, and upon selection, set that as your targets and send the request.

Unbounded requests will pick the first available item.
Developer
Posts: 889
Registered: ‎08-31-2009
My Device: 9530, 9630, 9800, 8530, 9900, 9810, 9930, PlayBook, Dev Alpha
My Carrier: Verizon

Re: Unbound share invocation always invokes BBM groups

That is what I was afraid of.

 

In Cascades this picker is automatically done for you on unbound requests. I had been hoping for the same here...


Read my thoughts on BlackBerry Development at news.ebscer.com
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Unbound share invocation always invokes BBM groups

AIR does not have one, but it is pretty easy to do.
Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Unbound share invocation always invokes BBM groups

[ Edited ]

My TitlePage class is just a class based on UIComponent with some other things in it, but you get the idea from here:

 

package com.lib.playbook.invocation
{
	import com.lib.playbook.controls.List;
	import com.lib.playbook.pages.TitlePage;
	import com.lib.playbook.renderers.IconListRenderer;
	
	import flash.events.Event;
	import flash.events.IEventDispatcher;
	
	import qnx.events.InvokeEvent;
	import qnx.events.InvokeQueryTargetEvent;
	import qnx.fuse.ui.core.Action;
	import qnx.fuse.ui.events.ActionEvent;
	import qnx.fuse.ui.events.ListEvent;
	import qnx.invoke.ActionQuery;
	import qnx.invoke.InvokeManager;
	import qnx.invoke.InvokeRequest;
	import qnx.invoke.InvokeTarget;
	
	public class InvokeSearchPage extends TitlePage
	{
		private var request : InvokeRequest = null;
		private var targets : List = new List();
		
		/////////////////////////////////////////////////////////////////////////////////////////
		public function InvokeSearchPage()
		{
			super();
			this.title = 'Search With';
			this.titlebar.dismissAction = new Action( 'Cancel', null, {id:'cancel'} );
			this.titlebar.addEventListener(ActionEvent.ACTION_SELECTED, ActionSelected );
			
			this.targets.cellRenderer = com.lib.playbook.renderers.IconListRenderer;
			this.targets.addEventListener(ListEvent.ITEM_CLICKED, TargetSelected );
			this.addChild( this.targets );
		}
		
		///////////////////////////////////////////////////////////////////////////////////////////
		public function filter( request :InvokeRequest ) : void
		{
			this.targets.removeAll();
			
			this.request = request;
			
			//trace( 'filter ' + request.mimeType );
			InvokeManager.invokeManager.addEventListener( InvokeQueryTargetEvent.SUCCESS, TargetsFound );
			InvokeManager.invokeManager.queryInvokeTargets( request.mimeType, request.uri, request.action, request.targetOptions );
		}
		
		///////////////////////////////////////////////////////////////////////////////////////////
		private function TargetsFound( event : InvokeQueryTargetEvent ) : void
		{
			InvokeManager.invokeManager.removeEventListener(InvokeQueryTargetEvent.SUCCESS, TargetsFound );
			//trace( 'TargetsFound' );
			var action : ActionQuery;
			var target : InvokeTarget;
			for each( action in event.actions )
			{	
			    for each( target in action.targets )
				{
				  this.targets.addItem( { data : target.target, label : target.label, icon : 'file://' + target.icon } );
				}
			}
		}
		
		////////////////////////////////////////////////////////////////////
		private function TargetSelected( event :Event ) : void
		{
			this.request.target = this.targets.selection;
			InvokeManager.invokeManager.invoke( this.request );
		}
		
		////////////////////////////////////////////////////////////////////
		private function ActionSelected( event :ActionEvent ) : void
		{
			switch( event.action.data.id )
			{
				case 'cancel' : this.dispatchEvent( new Event( Event.CANCEL ) ); break;
			}
		}
		
		//////////////////////////////////////////////////////////////////////
		override protected function updateDisplayList(unscaledWidth:Number, unscaledHeight:Number):void
		{
			super.updateDisplayList( unscaledWidth, unscaledHeight );
			
			this.targets.setPosition( 10, this.top + 10 );
			this.targets.setActualSize( unscaledWidth - 20, unscaledHeight - this.targets.y - 10 );
		}
	}
}