#jack-android-terminal-discovery
1 messages · Page 1 of 1 (latest)
hello
public class ReaderDiscoveryActivity extends AppCompatActivity implements DiscoveryListener {
Cancelable discoverCancelable = null;
// Action for a "Discover Readers" button
@SuppressLint("MissingPermission")
public void discoverReadersAction() {
DiscoveryConfiguration config = new DiscoveryConfiguration.BluetoothDiscoveryConfiguration(0, false);
discoverCancelable = Terminal.getInstance().discoverReaders(config, this, new Callback() {
@Override
public void onSuccess() {
Log.d("CordovaStripePlugin", "discoverReaders succeeded");
}
@Override
public void onFailure(@NonNull TerminalException e) {
e.printStackTrace();
}
});
}
// DiscoveryListener
@Override
public void onUpdateDiscoveredReaders(@NonNull List<Reader> list) {
}
}
m2
i havent gotten to connecting to it yet
but im simply trying to execute the code above
unfortunately
Are you seeing the onSuccess log?
What about the error case then?
it says that the bluetooth permissions must be requested before discovering
but when the app launches it already asked the user and they said allow
Does your app properly declare all permissions required?
it should
There are three pieces to that, shown here: https://stripe.com/docs/terminal/payments/setup-integration?terminal-sdk-platform=android#configure
if (
ContextCompat.checkSelfPermission(
this.cordova.getActivity(),
android.Manifest.permission.ACCESS_FINE_LOCATION
) !=
PackageManager.PERMISSION_GRANTED
) {
String[] permissions = {
android.Manifest.permission.ACCESS_FINE_LOCATION,
};
// REQUEST_CODE_LOCATION should be defined on your app level
ActivityCompat.requestPermissions(
this.cordova.getActivity(),
permissions,
REQUEST_CODE_LOCATION
);
}
Oh this is via Cordova?
I'm not sure whether the SDKs work via Cordova or not
But aside from the above snippet you'd also need the manifest entries and onRequestPermissionsResult
yes i have that method
But you're saying to reach neither the success nor error paths?
ok hold on
the function is called
this is the error i am getting
on app launch i do this
this then works assuming the user clicks allow
Ok, then everything works?
This seems to revolve around permissions propagation then
Are you using the Android SDK natively, or is Cordova some kind of intermediary here?
The only cross-platform framework we support currently is React Native
👋 jumping in here
Are you seeing the permissions dialogues when you run the app?
jack-android-terminal-discovery