PantryParty / pantry_party

Apache License 2.0
70 stars 8 forks source link

Question: does turning off the ads turns off the AdMob services usage totally? #99

Closed MPeti1 closed 4 years ago

MPeti1 commented 4 years ago

I'm using an Android device, and after downloading your app I see that the google components are really minimal, there's only a Content Provider by AdMob, and the QR scanner is a google library too, right?

I would like to know, though, whether you disable this Content Provider (com.google.android.gms.MobileAdsInitProvider) when I turn the ads off. I ask because built in content providers are always ran when an application starts (for initialization purposes), unless they are disabled through the Package Manager.

I would like to also know if you avoid initialization of and usage of AdMob and GMS components if the ads are turned off.

arjes commented 4 years ago

Hello @MPeti1,

Both of those libraries are wrapped by nativescirpt wrappers, I'm not messing with either the Java on C# packages myself.

Code Is here: https://github.com/PantryParty/pantry_party/blob/master/src/app/ad-wrapper/ad-wrapper.component.ts#L35

I think the answer to your question is that yes, the content provider is never created when you disable ads, we are not just pushing them off the screen or anything.

If you restart the application after you have disabled ads the AdMob client should never be instantiated.

Unfortunately since we are using a nativescript wrapper there is potential for behaviors unknown to me. You can always submit a question upstream too https://github.com/EddyVerbruggen/nativescript-admob.

If this doesn't answer your question, or you find a reason to suspect that user privacy isn't being respected please let me know ASAP.

MPeti1 commented 4 years ago

Thank you for the response!

I've checked if the content provider is disabled, but it doesn't seem to be. If I'm correct that the only mention of the AdMob library in the code is the file you linked, and that at the linked line all you do is initializing the AdMob client, then I think this is the reason.

The enabled state of a main component of an Android app (there are 4 types, one of them are the content providers) persists across application lifecycles, they only get disabled if they are disabled by the app, or when the user themselves disables it (not trivial). For 3rd party libraries with their own components like this it's not a common practice to disable these components when the application closes, because it's usually unnecessary, and disabling and enabling every time would put an unnecessary load on the system.

Could you disable the mentioned content provider when the ad switch is flipped off? I'm not familiar with the framework that you use, but I'm familiar with how it's done in Java, so if you need I could help. If you do this, you will need to re-enable the content provider when the switch is flipped back on, but before initializing the AdMob client, because otherwise it may crash or log errors describing that the needed content provider is disabled. I'm not sure if it would actually do this, because it (probably, again I'm only familiar with native apps) has the ability to enable the provider by itself, but this way it can't go wrong.

arjes commented 4 years ago

Thank you so much for looking into this for me, I don't have a ton of experience with real native apps.

I read up on ContentProviders, and this appears to be outside of what the wrapper provides me access to. (Source https://github.com/EddyVerbruggen/nativescript-admob/blob/master/src/admob.android.js )

If you can give me some example code in Java I'll take a look and see if it can be implemented. Honestly it isn't like I'm actually making money off the ads, I may just remove them all together.

On Tue, Aug 25, 2020 at 5:00 PM MPeti1 notifications@github.com wrote:

Thank you for the response!

I've checked if the content provider is disabled, but it doesn't seem to be. If I'm correct that the only mention of the AdMob library in the code is the file you linked, and that at the linked line all you do is initializing the AdMob client, then I think this is the reason.

The enabled state of a main component of an Android app (there are 4 types, one of them are the content providers) persists across application lifecycles, they only get disabled if they are disabled by the app, or when the user themselves disables it (not trivial). For 3rd party libraries with their own components like this it's not a common practice to disable these components when the application closes, because it's usually unnecessary, and disabling and enabling every time would put an unnecessary load on the system.

Could you disable the mentioned content provider when the ad switch is flipped off? I'm not familiar with the framework that you use, but I'm familiar with how it's done in Java, so if you need I could help. If you do this, you will need to re-enable the content provider when the switch is flipped back on, but before initializing the AdMob client, because otherwise it may crash or log errors describing that the needed content provider is disabled. I'm not sure if it would actually do this, because it (probably, again I'm only familiar with native apps) has the ability to enable the provider by itself, but this way it can't go wrong.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/PantryParty/pantry_party/issues/99#issuecomment-680267303, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABQ6MRNHZMWOFMJS7W7KX3SCQQ6XANCNFSM4QIWBKIQ .

MPeti1 commented 4 years ago

Thank you so much for looking into this for me, I don't have a ton of experience with real native apps.

No worries!

I read up on ContentProviders, and this appears to be outside of what the wrapper provides me access to

Yeah, 3rd party libraries usually don't provide this by themselves, but I think it's better this way, because if you do it for yourself then you know that it's actually done

I'm not exactly sure, but if you're using NativeScript (trying to judge by a few files), then according to this it's very similar to the native way.

Here is an example of how it's done in Java. This is the documentation of the method that is being used.

arjes commented 4 years ago

Thanks for the links. I know i can get access to the native apis in NS just need some examples. I'll review these and see what can be done.

On Tue, Aug 25, 2020 at 5:37 PM MPeti1 notifications@github.com wrote:

Thank you so much for looking into this for me, I don't have a ton of experience with real native apps.

No worries!

I read up on ContentProviders, and this appears to be outside of what the wrapper provides me access to

Yeah, 3rd party libraries usually don't provide this by themselves, but I think it's better this way, because if you do it for yourself then you know that it's actually done

I'm not exactly sure, but if you're using NativeScript (trying to judge by a few files), then according to this https://docs.nativescript.org/core-concepts/android-runtime/metadata/accessing-packages it's very similar to the native way.

Here https://stackoverflow.com/questions/23252078/can-i-enable-disable-contentprovider-programmatically is an example of how it's done in Java. This https://developer.android.com/reference/android/content/pm/PackageManager#setComponentEnabledSetting(android.content.ComponentName,%20int,%20int) is the documentation of the method that is being used.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/PantryParty/pantry_party/issues/99#issuecomment-680282288, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABQ6MXRCW4GC676LPPFVRDSCQVJVANCNFSM4QIWBKIQ .