javascript - React Native 无法打开 URL 找不到处理 Intent 的事件

标签 javascript react-native square square-connect

我正在使用 React Native 和 Square Point of Sale。我正在使用 Web API for Android . 我也安装了Square Point of Sale . 这是我的代码:

componentDidMount() {
    let url ="intent:#Intent;action=com.squareup.pos.action.CHARGE;package=com.squareup;S.browser_fallback_url=https://my.website.com/index.html;S.com.squareup.pos.WEB_CALLBACK_URI=https://my.website.com/index.html;S.com.squareup.pos.CLIENT_ID=sq0ids-yOurCLieNtId;S.com.squareup.pos.API_VERSION=v2.0;i.com.squareup.pos.TOTAL_AMOUNT=100;S.com.squareup.pos.CURRENCY_CODE=USD;S.com.squareup.pos.TENDER_TYPES=com.squareup.pos.TENDER_CARD,com.squareup.pos.TENDER_CARD_ON_FILE,com.squareup.pos.TENDER_CASH,com.squareup.pos.TENDER_OTHER;end";

    Linking.openURL(url).catch(err => console.error("An error occurred", err));
}

这是我的错误信息:

Could not open URL 'intent:#Intent; ... end': No Activity found to handle Intent { act=android.intent.action.VIEW dat=intent: flg=0x10000000 }

我做错了什么?

最佳答案

我尝试使用网络 API 进行构建,但发现流程不是很好。用户并不总能回到应用程序;有时他们会卡在网站上。

我 build 了 react-native-square-pos让下一个开发人员更容易。它使用 native 模块与 Android/iOS Square PoS API 进行通信。因此您不必编写 Java 或 Objective-C。

关于javascript - React Native 无法打开 URL 找不到处理 Intent 的事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48926171/

相关文章:

javascript - Angular 2 服务本地存储

javascript - 如何在重定向到新 View 之前在 Controller 中创建警报提示?

mobile - Square 是否有用于接受付款的 API?

OpenCV检测背景困难的方 block

ios - 如何在我的设备上而不是在 iPhone 6 模拟器中运行我的 React Native 应用程序?

python - 在 python 中从 2D 点创建一个矩形网络/列表

javascript - 有没有办法延迟提交表单来执行一些动画

javascript - 对文本内容进行过滤,并尝试将过滤后的内容转换为JSON

javascript - 一起显示昨天和今天的日期 javascript

react-native - 从样式表响应 native 访问状态