I'm currently developing a POC SDK, I need to add an ability to detect if any other 3rd party SDK's (from a finite list) are present on the current App that user my SDK.
For example, detecting that Google maps SDK is being used.
What would be the approaches of doing so on Android and on IOS?
Similar approach can be used for IOS as mentioned by @F43nd1r. Pick a public class and check if that is available or not.
Following is an example for Google Analytics. Google Analytics has a public class called GAI
(API Reference). If GAI
class is available we can assume app is using Google Analytics SDK.
if NSClassFromString("GAI") != nil {
print("App is using Google Analytics SDK")
}
Example for Google Analytics.
try {
if (Class.forName("com.google.android.gms.analytics.GoogleAnalytics") != null) {
Log.d(TAG, "App is using Google Analytics SDK");
}
} catch (Exception ex) {
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With