我们为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应用程序所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)