#morgane-helloasso_code
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1375403769201688656
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi, what code exactly on ' some code from our Application class creation is called without any action from us. '?
The onCreate() method is called
I see, let me grab a teammate who has more expertise with Terminal.
Hey! Taking over for my colleague. Let me catch up.
and some code from our Application class creation is called without any action from us. Is this normal and can we prevent this from happening ? It is problematic for another SDK we use, which is in this case initialised again while it shouldn't be.
Can you share more details on this ? what other SDK and what is the issue exactly ?
The issue is that we have some SDKs initialised in the onCreate method, and as Stripe seems to create a new process of the application, I am afraid the new initialisation will connect them to a strange other process. And we have a SDK from WorldLine which should be initialised only once
In that case you need to refactor your code and create the SDK from WorldLine elsewhere.
I don't know if it is problematic to initialise several times the same SDKs, but the code we use to prevent from the new initialisation was given to us by WorldLine to prevent this, because their SDK can cause this issue too
๐ค Some SDKs need to be initialised in the creation of the Application class, I can't move this code
Ah wait, you mean the Application class is created twice in your case ?
Yes
I don' think that Stripe SDK or any other SDK have the ability to initialize the Application twice or multiple time
According to WL, SDK can create a new process, which is an "isolated process" (I didn't know it was possible)
It happens at the moment I indicated in the help ticket, and when I leave the Tap to Pay feature, I come back where I was before in the app. So the app is not recreated or something, but I see clearly in the logs that the onCreate method has been called a new time
According to WL, SDK can create a new process, which is an "isolated process" (I didn't know it was possible)
How exactly ?
What part of the SDK code, that create an Application? can you share it ?
It happens at the moment I indicated in the help ticket, and when I leave the Tap to Pay feature, I come back where I was before in the app. So the app is not recreated or something, but I see clearly in the logs that the onCreate method has been called a new time
Have you tried to add an extra check before initializing the other SDK ? like the singelton pattern
I don't know how it works, when don't have access to their code or to their developpers ๐
We have an extra check which is supposed to check if the process is isolated, but it seems not to be sufficient (if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) Process.isIsolated() else Process.myUid() in FIRST_ISOLATED_UID..LAST_ISOLATED_UID)
I don't know how it works, when don't have access to their code or to their developpers ๐
You need to reachout to them then otherwise you need to switch to another SDK ๐
But it is your SDK which restart the Application class
I don't think it is normal ๐ค And I never had this case with any other SDK
I will try to create an empty application with only the Stripe SDK to check if the behaviour is the same, but nobody ever had this issue of a new creation of the Application class ?
AFAIK, no. This seems to be an issue/requirement with the other SDK you are referring to.
That's not sufficient for the other SDK you mean ?
If you have an external/third party that needs to be initated only once in your application, then you should add extra checks in that case in order to not re-create it again.
I will do a test and check with the WorldLine team, and I will then come back to you. Thanks for your answers