Advanced
You can set up some advanced features based on your requirements.
Get FCM Token
To obtain the FCM token of the user from the SDK, add the given snippet as per the requirement.
SmartPush.getInstance(new WeakReference<>(context)).getDevicePushToken();
SmartPush.getInstance(WeakReference(context)).getDevicePushToken()
SmartechSDK.getDevicePushToken((error, devicePushToken) => {
//Grab the devicePushToken
});
Fetching existing tokens from FCM
Important
This step is required only for SmartPush - version 3.3.1 and below.
To obtain an already generated token by Application, we can use the below method to get the existing token.
SmartPush.getInstance(new WeakReference<>(context)).fetchAlreadyGeneratedTokenFromFCM();
SmartPush.getInstance(WeakReference(context)).fetchAlreadyGeneratedTokenFromFCM()
SmartechSDK.fetchAlreadyGeneratedTokenFromFCM()
Get GUID
To get the GUID which CE\E SDK uses to identify the user, you can call the getGUID() method.
String guid = Smartech.getInstance(new WeakReference<>(context)).getDeviceUniqueId();
val guid=Smartech.getInstance(WeakReference(context)).getDeviceUniqueId()
SmartechSDK.getDeviceGuid((error, deviceGuid) => {
//Grab the deviceGuid
});
Debugging
To check the logs of Netcore CE SDK, you must implement a method named setDebugLevel(). By default, the debug level will be None.
Below are the Log levels.
LOG_LEVEL_VERBOSE
LOG_LEVEL_DEBUG
LOG_LEVEL_INFO
LOG_LEVEL_WARN
LOG_LEVEL_ERROR
LOG_LEVEL_FATAL
LOG_LEVEL_NONE
Smartech smartech = Smartech.getInstance(new WeakReference<>(this.getApplicationContext()));
smartech.setDebugLevel(SMTDebugLevel.Level.VERBOSE);
val smartech = Smartech.getInstance(WeakReference(this.getApplicationContext()))
smartech.setDebugLevel(SMTDebugLevel.Level.LOG_LEVEL_DEBUG)
Implementing InApp Trusted Host Validation for Webview cross-scripting
To reduce security risk from in-app messaging (InApp) WebViews—such as untrusted pages calling the native JavaScript bridge—the Smartech Android SDK can restrict InApp bridge APIs to trusted origins only. When enabled, the SDK validates each loaded page URL against an allow-list before exposing device, identity, or in-app action APIs to JavaScript.
Set enableTrustedHostsValidation and inAppTrustedHosts on SmartechConfig, then call Smartech.setConfig(config) before initializeSdk(). The SDK stores these values and, when validation is on, checks each InApp WebView URL against the allow-list before allowing bridge calls (getSmartechSDKData, getAppData, trackInAppAction).
val config = SmartechConfig().apply {
enableTrustedHostsValidation = true
inAppTrustedHosts = listOf(
"<https://cdndc.netcoresmartech.com/">,
"<https://cdnt.netcoresmartech.com/">,
"netcoresmartech.com",
"netcorecloud.com",
\<"">
)
}
Smartech.getInstance(WeakReference(applicationContext)).setConfig(config)
Smartech.getInstance(WeakReference(applicationContext)).initializeSdk(application)
###
SmartechConfig config = new SmartechConfig();
config.setEnableTrustedHostsValidation(true);
config.setInAppTrustedHosts(Arrays.asList(
"<https://cdndc.netcoresmartech.com/">,
"<https://cdnt.netcoresmartech.com/">,
"netcoresmartech.com",
"netcorecloud.com",
\<"">
));
Smartech.getInstance(new WeakReference\<>(getApplicationContext())).setConfig(config);
Smartech.getInstance(new WeakReference\<>(getApplicationContext())).initializeSdk(getApplication());
Implementing SDK Dependency Verification
To ensure your app always uses the authentic Smartech Android SDK from Netcore Artifactory—and not a modified or corrupted copy—your project must enable Gradle dependency verification. Netcore shares an official SHA-256 checksum with each SDK release; you add that value to a Gradle metadata file. On every build, Gradle compares the downloaded SDK with the approved hash. If they do not match, the build fails.
This integration follows Google’s official guidance: Verify build dependencies.
Step 1 - Create verification metadata file
Create a new file at the project root:
gradle/verification-metadata.xml
Paste the template below. Replace YOUR_SDK_VERSION and PASTE_SHA256_FROM_NETCORE with values from your Netcore release note.
Step 2 - Build and verify
If verification fails, confirm the SHA-256 matches the Netcore release note exactly, then clear the Gradle cache and rebuild:
rm -rf ~/.gradle/caches/modules-2/files-2.1/com.netcore.android/smartech-sdk ./gradlew clean :app:assembleDebug --refresh-dependencies
- Upgrading the SDK
When you upgrade to a new Smartech SDK version:
- Update the
implementationversion inbuild.gradle. - Obtain the new SHA-256 from Netcore for that version.
- Update
version,artifact name, andsha256inverification-metadata.xml. - Rebuild and commit both changes.
