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

Reply
Contributor
Posts: 11
Registered: ‎03-01-2013
My Device: Simulator BB10
My Carrier: unknown, company employer
Accepted Solution

Open files with a certain extension

[ Edited ]

Hey guys, 

 

This was asked a lot and i browsed through a dozen posts, yet none of the solutions worked. 

 

 

What i want (sounds pretty simple):

When clicking on attachents/files with the "abcd" - extension, in

 file system/finder/explorer-type apps

or 

 browser/email-type apps

 

open them it with my AIR-App (or ask "open with myapp" list)

and give me the path to the file in the (Air-) InvokeEvent, so i can process the file within my app.

 

I wonder if this might not be working due to the simulator and/or debug-mode.

 

Here`s the xml for the bar.xml:

 

	<invoke-target id="com.mycompany.mysuperapp">
		<invoke-target-type>application</invoke-target-type>
		<invoke-target-name>The super App</invoke-target-name>
		<icon>
			<image>kb_114x114.png</image>
		</icon>
		<filter>
			<action>bb.action.VIEW</action>
			<action>bb.action.OPEN</action>
			<mime-type>*</mime-type>
			<property var="exts" value="abcd"/>
			<property var="uris" value="file://,data_:_//,http://,https://"/>
		</filter>
	</invoke-target>

 

I tried it in several combinations (only files://, only data_:_//... aso, application, viewer)

 

When i run in debugmode, 

NativeApplication.nativeApplication.applicationID returns -> com.mycompany.mysuperapp.debug

 

 

So i also tried 

<invoke-target id="com.mycompany.mysuperapp.debug">

just to make sure. No success.

 

What am i doing wrong ?

Can someone confirm that it can be done after all - in AIR - ?

 

Thank you.

V.

 

EDIT:

<allowBrowserInvocation>true</allowBrowserInvocation

is added the air-descriptor.xml

 

 

 

 

 

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Open files with a certain extension

Just have the open action.
Just have the 'file://' uris if you are just opening files. The data things is probably messing up the registration (where did you see that syntax?).

Dont need the target name, it will use the app name.

Dont need the icon, it will use the app icon (unless you want to show something different).

Yes, receiving file invocation works fine in AIR.

The ID for the invocation target may need to be appended with more. If it is my app, and the type is "application", I append it with ".app" since you can have more than one invocation target definition.
New Contributor
Posts: 4
Registered: ‎07-03-2013
My Device: developper
My Carrier: none

Re: Open files with a certain extension

hi guys,

how can i get some data from the file that's invoking my app.

i m working on Qnx momentics and im new in C++.

im using a simple cascade app that is invoked by an XML file i used this script:

<invoke-target id="com.example.AlMuatamad">

    <invoke-target-type>APPLICATION</type>

       <filter>

             <action>bb.action.OPEN</action>

             <mime-type>*</mime-type>

             <property var="uris" value="file://"/>

             <property var="exts" value="xml"/>

       </filter>

  </invoke-target>

the invocation is working but how can i get some data from the XML file (It's name for example).

thanks.

 

Developer
Posts: 6,541
Registered: ‎10-27-2010
My Device: HTC One, PlayBook, LE Z10, DE Q10
My Carrier: Verizon

Re: Open files with a certain extension

The path is in the invocation to your app. You can then open up the file from that path and parse the XML data. This is the AIR forum. Though invocation is the same in all environments, the processing of the invocation is different. Suggesting browsing the NDK/Cascades forum for more details.
Highlighted
New Contributor
Posts: 4
Registered: ‎07-03-2013
My Device: developper
My Carrier: none

Re: Open files with a certain extension

ok, 10x That's my solution Smiley Happy