NAXAM / braintreedropin-android-binding

Xamarin.Android binding library - Braintree DropIn
MIT License
0 stars 2 forks source link

AndroidManifest android:scheme for PayPal Integration #1

Closed kenny128 closed 6 years ago

kenny128 commented 6 years ago

According to the Drop-in UI documentation on braintree to implement PayPal Integration

Edit your AndroidManifest.xml to include BraintreeBrowserSwitchActivity and set the android:scheme:

`<activity android:name="com.braintreepayments.api.BraintreeBrowserSwitchActivity" android:launchMode="singleTask">

`

https://developers.braintreepayments.com/guides/client-sdk/setup/android/v2/#browser-switch-setup

I tried using my package id for the android:scheme section but it doesn't work... in my case my package id is "com.Organisation.ACBCompany.Android" and used ""com.organisation.acbcompany.android" but it doesn't work. Do i have to do anything special since it isn't exactly the same as the java counterpart?

tuyen-vuduc commented 6 years ago

@kenny128 Plz send the final code you set in your manifest file.

kenny128 commented 6 years ago
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.3.16" package="com.organisation.ACBCompany.Android" android:installLocation="auto" android:versionCode="24">
    <uses-sdk android:minSdkVersion="15" android:targetSdkVersion="23" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
  <uses-permission android:name="android.permission.USE_FINGERPRINT" />
  <uses-permission android:name="com.samsung.android.providers.context.permission.WRITE_USE_APP_FEATURE_SURVEY" />
    <application android:debuggable="false" android:label="ACB" android:theme="@android:style/Theme.Holo.Light" android:icon="@drawable/appicon" android:largeHeap="true" android:hardwareAccelerated="false"></application>
    <activity android:name="ShareActivity">
        <intent-filter>
            <action android:name="android.intent.action.SEND" />
            <category android:name="android.intent.category.DEFAULT" />
            <data android:mimeType="image/*" />
        </intent-filter>
    </activity>
  <activity android:name="com.braintreepayments.api.BraintreeBrowserSwitchActivity"
    android:launchMode="singleTask">
    <intent-filter>
      <action android:name="android.intent.action.VIEW" />
      <category android:name="android.intent.category.DEFAULT" />
      <category android:name="android.intent.category.BROWSABLE" />
      <data android:scheme="com.organisation.acbcompany.android.braintree" />
    </intent-filter>
  </activity>
</manifest>
tuyen-vuduc commented 6 years ago

Plz use lower case for our package id to see if it works.

kenny128 commented 6 years ago

@tuyen-vuduc it didn't work... still getting the same exceptions

Com.Braintreepayments.Api.Exceptions.BraintreeException: BraintreeBrowserSwitchActivity missing, incorrectly configured in AndroidManifest.xml or another app defines the same browser switch url as this app. See https://developers.braintreepayments.com/guides/client-sdk/android/v2#browser-switch for the correct configuration

kenny128 commented 6 years ago

@tuyen-vuduc can i just confirm that you are able to replicate the same issues?

kenny128 commented 6 years ago

I found that I had my AndroidManifest wrong and i had to have had the activity tags within the application tag. Even after changing tho the issue is still the same.

I mimicked the test on where the exception is being returned and can see that it fails on line 683 on https://github.com/braintree/braintree_android/blob/866210e4036462fc0b59839f431a4e43056541f1/Braintree/src/main/java/com/braintreepayments/api/PayPal.java#L683

whereAppHelper.isIntentAvailable(fragment.getApplicationContext(), intent)returns false...

I tracked it down to https://github.com/braintree/braintree_android/blob/44e20eed28af498e980202f9f12579911be6e249/Core/src/main/java/com/braintreepayments/api/internal/AppHelper.java#L13

where activities.size() == 1 is false

kenny128 commented 6 years ago

Testing on and actual device actually worked. Testing on a colleagues' simulator also works which was very odd to me. I still can't figure out why it isn't working on my simulator and its working on pretty much everything else.