android – 将参数从java活动传递到Adobe AIR应用程序

android – 将参数从java活动传递到Adobe AIR应用程序,第1张

概述我们如何在启动另一个AIR类型的应用程序时从 Java Activity传递参数? 我们为java活动做的方式是使用Intent的额外功能. Android上的java Activity和AIR app是什么参数传递机制.目前我们通过共享一个公共位置(sqlite db)并每秒轮询它来传递参数.这不是一个好的设计,我相信必须有一些好的方法来做到这一点.请赐教. 在Adobe AIR 2.5中,您可 我们如何在启动另一个AIR类型的应用程序时从 Java Activity传递参数?

我们为java活动做的方式是使用Intent的额外功能. Android上的java Activity和AIR app是什么参数传递机制.目前我们通过共享一个公共位置(sqlite db)并每秒轮询它来传递参数.这不是一个好的设计,我相信必须有一些好的方法来做到这一点.请赐教.

解决方法 在Adobe AIR 2.5中,您可以使用自定义URI将参数传递给AIR应用程序.

By using this feature an application can be made invokable from browser or native androID application. When the application is invoked from browser/androID-app,an InvokeEvent is dispatched to the application.
For making an application invokable from browser,add this in your application descriptor (as child of application element):

<androID>    <manifestAdditions>    <![cdaTA[        <manifest>            <application>                 <activity>                     <intent-filter>                         <action androID:name="androID.intent.action.MAIN"/>                         <category androID:name="androID.intent.category.LAUNCHER"/>                     </intent-filter>                     <intent-filter>                         <action androID:name="androID.intent.action.VIEW"/>                         <category androID:name="androID.intent.category.broWSABLE"/>                         <category androID:name="androID.intent.category.DEFAulT"/>                         <data androID:scheme="testapp"/>                     </intent-filter>                 </activity>             </application>         </manifest>     ]]>     </manifestAdditions></androID>

Now to launch your application from browser,provIDe the url as: testapp://. An example is:

<a href="testapp://">click here to launch air test app from browser</a>

Clicking on this link will launch your application.

If you want to pass additional arguments to your application from browser,use something like this:

<a href="testapp://arg1=value&secondArgument=someValue">click here to launch air test app from browser</a>

Once your application gets launched,fetch the arguments property of received InvokeEvent. This will contain the complete URI (testapp://arg1=value&secondArgument=someValue) and you can parse it to extract the arguments.

从here起.

总结

以上是内存溢出为你收集整理的android – 将参数从java活动传递到Adobe AIR应用程序全部内容,希望文章能够帮你解决android – 将参数从java活动传递到Adobe AIR应用程序所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://www.outofmemory.cn/web/1136746.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-30
下一篇 2022-05-30

发表评论

登录后才能评论

评论列表(0条)

保存