从开始的PhoneGap插件的活动,webIntent [英] Starting activity from phonegap plugin-webIntent

查看:425
本文介绍了从开始的PhoneGap插件的活动,webIntent的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的Andr​​oid应用程序配置webintent插件。我想从我的UI页面上点击一个按钮启动的活动。活动采取任何PARAMS。我已经通过这个链接了
https://github.com/phonegap/phonegap-plugins/tree/主/ Android的/ WebIntent / 但IM没有得到如何调用了这样一个简单的活动。没能拿到什么URL字段用于......。一多,事儿清单文件所需的任何配置,如调用活动的意图过滤器。

I have configured webintent plugin in my android app . I want to start an activity from a button click on my UI page . The activity takes no params . I have gone through this link https://github.com/phonegap/phonegap-plugins/tree/master/Android/WebIntent/ but i m not getting how to call a such a simple activity . Not able to get the what url field is used for .... . One more , are thing any configuration required in manifest file such as intent filters for calling activity .

推荐答案

不知道这能帮助:

https://github.com/phonegap/phonegap-plugins/issues/1009

<一个href=\"https://github.com/Richardsonke/phonegap-plugins/commit/d0343f49022d9ece97f70af42400636d8d0a64d8\" rel=\"nofollow\">https://github.com/Richardsonke/phonegap-plugins/commit/d0343f49022d9ece97f70af42400636d8d0a64d8

编辑1:
好吧,我知道了现在的工作,
在AndroidManifest.xml中添加这些行(活动里你想要的按钮进入)

EDIT 1: Ok I got it working now, in your AndroidManifest.xml add these Lines ( Inside the Activity you want the Button to go to )

<intent-filter>
     <action android:name="com.example.yourapplication.UNIQUESTRING" />
     <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

一定要com.example.yourapplication改变你的包
和UNIQUESTRING是一些独特的

be sure to change "com.example.yourapplication" to your package and UNIQUESTRING to be something Unique

在Javascript使按钮触发这个JS:

in Javascript make the button fires this JS :

window.plugins.webintent.startActivity(
  {
    action: 'com.example.yourapplication.UNIQUESTRING',
  }, 
  function() {}, 
  function() {alert('Failed to open URL via Android Intent')}
);

这篇关于从开始的PhoneGap插件的活动,webIntent的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆