Square Web API for Android Kills App - android

I am unable to make a successful connection with the square reader via android request after following documentation found at https://docs.connect.squareup.com/articles/web-api-android
It seems straightforward, but the connection links end up crashing the app or causing it to restart without any error reporting or callback information sent to either S.browser_fallback_url or S.com.squareup.pos.WEB_CALLBACK_URI.
Sample link activated on dev server (127.0.0.1) is: intent:#Intent;action=com.squareup.pos.action.CHARGE;package=com.squareup;S.browser_fallback_url=http://localhost:8080/tb/square;S.com.squareup.pos.WEB_CALLBACK_URI=http://localhost:8080/tb/square;S.com.squareup.pos.CLIENT_ID=secret;S.com.squareup.pos.API_VERSION=v2.0;i.com.squareup.pos.TOTAL_AMOUNT=150;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;S.com.squareup.pos.REQUEST_METADATA=5a982466e7b46;S.com.squareup.pos.NOTE=This will be a note!;end
For the CLIENT_ID I was instructed to use Application ID found at https://connect.squareup.com/apps/
Firmware on Contactless, Chip reader is 2.9.36 which is connected to the android device via bluetooth.
--edit--
First time through
https://ibb.co/kSBUYH
https://ibb.co/fyUGDH
Second time through
https://ibb.co/duFZ0x
https://ibb.co/i1MUYH

To bring this out of the comments, the issue was missing the web callback URL being registered in the Square Developer Portal.
You want to be sure to register your callback URL(s)
In order for Square Point of Sale to accept a request from your website, Square needs to verify that you have registered a web callback URI for the application in the Application Dashboard.
First, go to the Application Dashboard, then click on the Point of Sale API tab of your application's settings. Under the Web section, specify your app's web callback URI under the corresponding field.
If your transaction does not succeed for any reason, you should be receiving a error back to you.

Related

Deeplinking Squareup pos app is not working

The documentation link: https://developer.squareup.com/docs/pos-api/build-mobile-web#step-5-test-your-code suggest straight forward code like this:
<a href="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_CASH;
end">Start Transaction</a>
I tested it and it does not open any link, my devide already have app installed.
When I try this code:
Take a QR code 2
It open play store app with squareup pos app information, I need to directly open the app and not play store screen of the app, is there any way?
*UPDATE:
I got transactions to work after adding S.com.squareup.pos.LOCATION_ID={{ my_location_id }}. The location ID can be found in Square Developer Portal > Locations. Also if the POS app is passcode protected, you have to open and login with passcode before sending transaction.
*END UPDATE
I've been working through this same issue. I still haven't gotten a transaction to work, but have at least gotten the app to open.
Make sure the CLIENT ID is your production application ID. NOT sandbox.
The WEB_CALLBACK_URI needs to match the Web Callback URL defined in your Square Developer Portal > Point Of Sale API.
I hope this helps. If you do figure this out and get transactions to work, please post your solution for me and others who are sure to run into this issue since the documentation is lacking.

Disable user login from multiple devices at the sametime, in Ejabberd/XMPP

Environment:
Ejabberd Version : 16.04
Smack-android-4.1.0
I'm working on an Android chat application. Currently, same user credentials can be used login from multiple devices.
The current scenario is as follows:
1. User logs in into the app in device A
2. Using the same username and password, the user logs successfully into the app in device B
3. Now device A says, it is disconnected, but continue the chat in device B
However, according to the given requirement, it should behave like this:
1. User logs in into the app in device A
2. Using the same username and password, when the user tries to log in from device B, it should not allow it.
(Since he is already logged in from device A)
Would be glad to hear your solutions/ideas on this. Thanks in advance.
So I managed to resolve the problem using the option resource_conflict
According to Ejabberd Configuring Docs
The option resource_conflict defines the action when a client attempts
to login to an account with a resource that is already connected. The
option syntax is:
resource_conflict: setresource|closenew|closeold: The possible values
match exactly the three possibilities described in XMPP Core: section
7.7.2.2. The default value is closeold. If the client uses old Jabber Non-SASL authentication (XEP-0078), then this option is not respected,
and the action performed is closeold.
So open ejabberd.yml and add the following line to that file.
resource_conflict: closenew
Then restart the ejabberd server.
Now it will disallow the resource binding attempt of the newly connecting client and maintain the session of the currently connected client.
References:
https://www.rfc-editor.org/rfc/rfc6120#section-7.7.2.2
Read #rubycon's answer on this- https://stackoverflow.com/a/51860779/5361779
From XMPP spec:
"If there is already an active resource of the same name, the server MUST either (1) terminate the active resource and allow the newly-requested session, or (2) disallow the newly-requested session and maintain the active resource. Which of these the server does is up to the implementation, although it is RECOMMENDED to implement case #1."
More info here https://xmpp.org/rfcs/rfc3921.html#session
So your current scenario is a recommended one.
However, I have quickly checked for ejabberd src code and found it can be configured somehow (closeold -> closenew)
https://github.com/processone/ejabberd/blob/master/src/ejabberd_c2s.erl#L964
https://github.com/processone/ejabberd/blob/master/src/ejabberd_c2s.erl#L873
I'm not an Erlang specialist, but looks like it can be achieved by modifying the source code
If device B sets as resource one different than device A, both can be connected to the same account correctly. In your tests, device B sets the exact same resource than device A, and then ejabberd kicks the older session.
I see there's an option to limit the number of sessions an account can have active in the server. The problem is that it kicks the older session, but you would like to disallow the new login. See
https://docs.ejabberd.im/admin/configuration/#limiting-opened-sessions-with-acl

Chrome Sender Sample App

I am trying to make an app for personal use that has the same functionality of the chrome sender sample app (https://github.com/googlecast/CastHelloText-chrome)
The only thing I am trying to change is the "SAMPLE APP" at the top of the casted screen. I have registered my device via the console and created a new custom receiver in this receiver i have included a URL for a Google drive HTML document I made (Just a black HTML page: https://www.googledrive.com/host/0B7IBRkdKpfYSRmZCYzJaTUpDamM
I then took my newly acquired application id and injected it into the code replacing the Googles sample app ID... I am using Mongoose to host the webpage locally and after I type a message I get no option to connect to my cast device.
Also I have entered my computers local IP and port number (where I am hosting the sender app) under sender details (chrome). I have tried Google's sample code and it works fine the only thing I have changed is the application ID.
Thanks!
I tried the same thing a week ago and the google drive's trick (to host an html page) doesn't work for me.
Your receiver app (your black html page) need to be accessible online, otherwise it's impossible to connect your sender app to your cast device.
So you must put your html file on a server. Do you have a personnal server to host it ?
I pushed your html file on my server and it's connected to a new App ID. Can you try with this App ID : E46DA3D7
If it's working then your probleme is really Google Drive hosting.
Let me know ;)

How to get the Log and Crash data for android live app?

I have developed one android application. Now we are testing this application in production environment.
I have to track the below information with out depending on tester to share the log file,
Send Log file. May be Logcat data. Foe Example If any web service fails we need to write that into log file then same needs to be sent to the server or to given mail id.
If there is any crash in our app then we can get the stach track by using getDefaultUncaughtExceptionHandler then we need to send the stack trace info via mail or send it to web server.
Or else I can use any solution provider like Google Analytics, Crashlytics or else I can write the log data to text file. And then same to be sent via mail on a daily or weekly basis.
Help me on this.
It's about time you move to crashlytics https://try.crashlytics.com/ or critisism http://www.crittercism.com/ check it out, infact there is ton of other options out there
With a service like http://www.apteligent.com (Crittercism renamed to Apteligent), when looking at a crash, you'll be able to automatically see a log of: web service calls, network connectivity changes, changes to screen views, and app foreground/background events that led up to the crash without manually adding any additional logging to your app:
https://www.apteligent.com/2016/03/working-automatic-breadcrumbs/

Opentok hello world activity unable to join session

I am trying to run opentok helloworld application
using this opentalk_hello_world (please login on git to access that url).
I did everything as it was instructed in that url which I mentioned above but I was not able to run the app.
There are two queries:
on 4th point its said that "The first time the app runs, it prompts the user to allow the app to use the camera to stream live video." which i was never asked!
on 5th point its said that "Once the app connects to the OpenTok session, it publishes an audio-video stream, which is displayed onscreen. Then, the same audio-video stream shows up as a subscribed stream (along with any other streams currently in the session)."
I have created sessionid and tokenid and replaced them in the activity. When I run the app I get the following in the logcat
02-25 14:07:00.640: E/demo-hello-world(6421): session failed! com.opentok.android.OpentokException: Session Compatibility Mismatch - There was a mismatch with the session's capabilities. You're likely trying to connect Android to a P2P Flash session on the web.
can you guys let me know where I am going wrong ?
did you create your session id from your dashboard? When generating the session id, make sure that p2p is not enabled! Also, make sure your token has publisher role so you can stream video.

Categories

Resources