我正在使用 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/