Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amazon Appstore #370

Closed
curiousdustin opened this issue Jan 20, 2019 · 30 comments
Closed

Amazon Appstore #370

curiousdustin opened this issue Jan 20, 2019 · 30 comments
Labels
🥺 feature request Request a new feature 🏃🏻‍♀️ in progress Currently working on ❓ question Further information is requested 🚶🏻 stale Stale

Comments

@curiousdustin
Copy link
Contributor

Does this module support Amazon Appstore IAPs?

@hyochan hyochan added ❓ question Further information is requested 🎯 feature New feature labels Jan 21, 2019
@hyochan
Copy link
Owner

hyochan commented Jan 21, 2019

No. We don't support kindle device because we don't have one here. There is PR on our flutter plugin but no one contributed to this one yet.

@gborges0727
Copy link

Not sure if anybody has begun work on this, however I've started implementing the functionality to support the Amazon Appstore IAPs. Hopefully will have a PR ready soon.

@hyochan hyochan added the 🏃🏻‍♀️ in progress Currently working on label Feb 7, 2019
@hyochan
Copy link
Owner

hyochan commented Feb 7, 2019

@gborges0727 I think you are in. I've changed the label to working. Thank you!

@hyochan hyochan added 🥺 feature request Request a new feature and removed 🎯 feature New feature labels Mar 14, 2019
@curiousdustin
Copy link
Contributor Author

@gborges0727, I see your fork, and that you at least started on some amazon related code.

What is the status of this work?

I'm at the point in my project where I need to add Amazon support.

It would be awesome if someone has already figured this out :)

@gborges0727
Copy link

Work is actually done, just haven’t gotten around to writing up the typescript / updating the readme quite yet. Hopefully will have a PR ready this weekend!

@curiousdustin
Copy link
Contributor Author

curiousdustin commented Mar 27, 2019

Sweet! Great to hear. I'm actually testing out your fork over the next few days or so. I'll let you know what I find.

My app is specifically using a subscription product with 2 period options ,monthly and annual.

What sort of testing have you done with this? Have you tested subscription products at all?

@curiousdustin
Copy link
Contributor Author

Also I noticed that your method of determining Amazon vs Other devices is to check for the amazon.hardware.fire_tv feature.

Is this because your app is actually specifically for Fire TV, or will this actually be true for all Amazon devices including tablets and such?

@gborges0727
Copy link

I’ve actually only tested subscription products so if you have any single purchase that would be a good test as well. And my app is specifically for fire_tv which is why i used that. Likely a more general option out there to test against for any amazon device

@curiousdustin
Copy link
Contributor Author

curiousdustin commented Mar 27, 2019

ok, I found this, which seems like it should be pretty reliable.

import android.os.Build;
isAmazonDevice = Build.MANUFACTURER.equals("Amazon");

My research found other options, including attempting to detect what STORE the app was installed from, but, I figure device detection is good enough for most.

@curiousdustin
Copy link
Contributor Author

Were you not getting errors about using the Set class?

I was getting the following when trying to use the amazon version of getProductData()

java.lang.RuntimeException: Got unknown argument class: Set

This was my work around:

public RequestId getProductData(ReadableArray skus, Promise promise) {
	
	//Build Set from ReadableArray
	final Set<String> skusSet = new HashSet<String>();
	for (int i = 0; i < skus.size(); i++) {
	  skusSet.add(skus.getString(i));
	}

    savePromise(GET_PRODUCT_DATA, promise);
    RequestId requestId = PurchasingService.getProductData(skusSet);
    return requestId;
  }

@curiousdustin
Copy link
Contributor Author

Also, do you know how to disable the dependency on Google Play services at runtime, when on an amazon device?

I am getting a popup that says:

[App Name] won't run without Google Play services, which are not supported by your device.

Sorry so many questions, I don't mean to spam you. Thanks again for the awesome work!

@curiousdustin
Copy link
Contributor Author

I made a few more changes.

If you're interested you can see my fork/branch here:
https://github.com/curiousdustin/react-native-iap/commits/curious

  • I did some work to apply the latest changes from the main fork, mostly the checks for native modules. commit.
  • As mentioned, I found I had to use ReadableArray in place of Set commit
  • I'm checking the manufacturer instead of the specific fire_tv id. commit
  • Because I will be using RVS, I felt it would be useful to add userIdAmazon to the purchase objects. commit

Haven't done a whole lot of testing yet, but seems good so far. Thanks again!

@gborges0727
Copy link

Hey sorry for getting back late! I believe the depedency on google play services at runtime can be resolved by adding something to your AndroidManifest.xml but I can’t recall exactly what it was that I added. The errors around getProductData() could be completely valid! I did not really test that function so could 100% be issues there. Your changes look good! Makes sense to incorporate them before submitting the PR here.

@curiousdustin
Copy link
Contributor Author

Oh, I forgot to mention, I did figure out that the specific won't run without Google Play services message I was getting, was actually a result of using Firebase. I found a hacky work around to just not initialize Firebase if on Amazon, and I still get warnings in the logs, but it doesn't seem to affect the user anymore.

Any info you can share about the manifest file could still be valuable.

Thanks!

@gborges0727
Copy link

Taking a look back at my androidmanifest i'm not actually sure what I would have included that would have resolved any issue.. Might have been remembering ghosts as far as that is concerned haha. Any luck with testing around some more?

@curiousdustin
Copy link
Contributor Author

I wouldn't say that I've tested exhaustively. Still only testing with subscription products.

I did add a few more modifications:

@acerbetti
Copy link

Thank you for the work here, I fixed the function that checks which store to use
curiousdustin#1

@vuitv
Copy link

vuitv commented May 23, 2019

Can I use this function? I need it

@DannyRox23
Copy link

DannyRox23 commented Jun 7, 2019

Is there any documentation on how to use your Amazon code @curiousdustin @gborges0727 ?

I need to add Amazon IAP Support for my apps so I really need this.

@curiousdustin
Copy link
Contributor Author

@DannyRox23 , sorry, there is no documentation past our discussions here.

Here are some clarifications:

  • Our live app is currently using the code found here: curiousdustin@a0911a8
  • We are using gradle build variants to build a separate APK for amazon. This code in this branch uses the automatically generated build config properties to determine if it is the amazon APK or not.
  • Our app ONLY has 1 Auto-renew Subscription IAP.
  • We have NOT tested any other type of IAP or features.
  • We use server side receipt validation for all platforms.

Hope that helps. Wish I could give back to the community more by fully testing this and adding it to the main library, but I just don't have the time. Thanks again @gborges0727 for doing most of the work 👍

@DannyRox23
Copy link

@curiousdustin I appreciate the reply! I used your code and I got rid of the device checks since the app is exclusively for Amazon devices. I am a bit lost, however; even with the device checking, I submitted my Amazon app to Amazon and Amazon reports that the app is using Google's IAP, so they didn't approve the app.

How do I debug the app to see if it's working. Should it show the Amazon IAP purchase window on emulators? Do I need an Amazon device to fully test? Does it work with Bluestacks? Are there any Amazon device emulators I can use?

@curiousdustin
Copy link
Contributor Author

I was able to remove the google billing warnings by using this manifest file that merges with my main manifest file. I think the key is the line to remove the billing permission.

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
	xmlns:tools="http://schemas.android.com/tools"
    package="fm.pinna.app">

	<uses-permission android:name="com.android.vending.BILLING" tools:node="remove" />

    <application>
        <receiver
            android:name="com.amazon.device.iap.ResponseReceiver"
            android:permission="com.amazon.inapp.purchasing.Permission.NOTIFY">
            <intent-filter>
                <action android:name="com.amazon.inapp.purchasing.NOTIFY" />
            </intent-filter>
        </receiver>
    </application>

</manifest>

@curiousdustin
Copy link
Contributor Author

There may be Amazon emulators, but I have not used them. I used actual Kindle Fire devices to test with. I have also not used Bluestacks, sorry I don't know if it would work.

For testing, I just followed the Amazon docs.

@benoitdion
Copy link

@hyochan would you be open to merging some Amazon support if it only includes support for Subscription billing?

@gborges0727
Copy link

Who has the most up to date fork of the code / can we try to get the PR into the main package potentially? To echo @benoitdion would it be alright to merge with just support for subscription billing?

@curiousdustin
Copy link
Contributor Author

curiousdustin commented Aug 5, 2019

I have not fully kept up with the progress of the main react-native-iap module. However, I think there have been major changes since @gborges0727 and I were working on this. Mainly re-working the purchase flow and other breaking changes that come with version 3.0.

#510

So, I don't think either of our Amazon implementations would be ready to merge with the main fork at this time, even for only subscriptions. 😞

@stale
Copy link

stale bot commented Nov 3, 2019

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as "For Discussion" or "Good first issue" and I will leave it open. Thank you for your contributions.

@stale stale bot added the 🚶🏻 stale Stale label Nov 3, 2019
@stale
Copy link

stale bot commented Dec 3, 2019

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

@stale stale bot closed this as completed Dec 3, 2019
@hpereira98
Copy link

hpereira98 commented Jan 21, 2020

@curiousdustin Do you think you can PR your changes with the Amazon Store compatibility to the master branch ? It would be very useful

@curiousdustin
Copy link
Contributor Author

The updates we made to support Amazon, are not compatible with the major changes in 3.0. See above.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🥺 feature request Request a new feature 🏃🏻‍♀️ in progress Currently working on ❓ question Further information is requested 🚶🏻 stale Stale
Projects
None yet
Development

No branches or pull requests

8 participants