我正在与React Native和Square Point的销售点一起工作。我正在为Android使用Web API。我也安装了方形销售点。这是我的代码:
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 }
我做错了什么?
我尝试使用Web API构建,但发现流程不佳。用户并不总是将其返回到应用程序;有时他们被困在网站上。
我构建了react-native-square-pos
,以使下一个开发人员更容易。它使用本机模块与Android/ios Square POS API进行通信。因此,您不必编写Java或Objective-C。
您正在使用的intent:#Intent
实际上并没有从React Native内部使用,因为它用于从Android设备上的Web浏览器转到Square Pos App上。
Android Web API intent
旨在从浏览器到Square POS应用程序,而不是从应用程序到应用程序。
听起来您想做的就是使用Android的Square Point of Android使用React Native应用程序。您需要查看https://facebook.github.io/reaeact-native/docs/native-modules-android.html,涉及如何将本机模块与您的React Native应用程序联系起来。