Closed RoyiNamir closed 6 years ago
Hey @RoyiNamir , thanks for this, but i want a bit more info when does this happen, before I merge this. In my tests i have never received the intent to be null. Are you sure you followed the set up in the tutorials? Also in what cases did you get the intent to be null?
I do not want to merge this and "mask" a possible user error.
@PeterStaev Sure I will give you full details. Just bare with me :
This is the EXACT code I'm using in my app : https://gist.github.com/RoyiNamir/82d6ad32cca946a4c84bd53a3c51f974
It's a service ( like i've posted here before , of all API promisified).
And this is how I consume it : https://gist.github.com/RoyiNamir/a0033d1438fb306b10956eeae502b36a
Please notice that test failed only in a certain device from google tests :
Where my version was 15.
And this is the exact error I provided :
On an earlier version , it happened in another device :
Now i'm at version 16 ,after the fix :
BTW , it's not that I've changed the flow. Programatically speaking , a property can be null. and if it can be null , we should see how we deal with it.
I don't know why activity was null I can think of some thoughts:
The code doesn't clean the purchas.on
method callback.
Also , the user might have been minimizing the app while callback was running . , and you don't check if activity exists on callback. this is the exact PR I did in eddy's code , to check activity on callback :
https://github.com/EddyVerbruggen/nativescript-admob/commit/f0487b321fb8a70952fa125949bc7fca3fb9d7ac
Ok, after further search, seems it is a random error from Google. It does not relate to activity whatsoever since the code does not use the activity. after the purchase has been made and the intent data is what Google returns from purchase. So probably more like a problem contacting the Google services.
I will see to add your code, but will rewrite it since I don't like the multiple checks for the intent
.
Changes have been added with c2a8b22
Ok. I've uploaded an app to google play store and in the pre tests , I got an error :
searched who activate this method :
Finding the method and the line :
led me to the plugin code :
for some reason this :
var intent = args.intent;
is null on some callbacks.