React Native Could not open URL No Activity found to handle Intent

3

I'm working with React Native and Square Point of Sale. I'm using Web API for Android. Also I have installed Square Point of Sale. This is my code:

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));
}

This is my error message:

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

What I'm doing wrong?

javascript
react-native
square
square-connect
asked on Stack Overflow Feb 22, 2018 by Evgeniy • edited Feb 22, 2018 by Evgeniy

2 Answers

0

The intent:#Intent that you're using there isn't really going to work from within React Native, since that is used for going from a web browser on an Android device into the Square POS app.

The Android Web API intent is intended to do a hand-off from your browser to the Square POS application, not from application to application.

It sounds like what you'd be wanting to do is use the Square Point of Sale SDK for Android with your React Native application. You'll want to take a look at https://facebook.github.io/react-native/docs/native-modules-android.html about how to link a native module with your React Native application.

answered on Stack Overflow Feb 22, 2018 by mootrichard
0

I tried building using the web API but found that the flow wasn't great. The user doesn't always make it back to the app; sometimes they get stuck on the website.

I built react-native-square-pos to make things easier for the next developer. It uses Native Modules to communicate with the Android / iOS Square PoS APIs.. so you don't have to write Java or Objective-C.

answered on Stack Overflow May 27, 2019 by connorbode

User contributions licensed under CC BY-SA 3.0