# Example code Source: [https://docs.qualcomm.com/doc/80-PK177-134/topic/gtp_example_code.html](https://docs.qualcomm.com/doc/80-PK177-134/topic/gtp_example_code.html) ## Java **Required imports** private IQesdk mQesdkManager; private GTPManager gtpManager;Copy to clipboard **Create the QESDK Manager instance.** IQesdk mQesdkManager = IQesdk.createInstance(this);Copy to clipboard **Create GTP Manager instance** GTPManager gtpManager = new GTPManager(qesdkManager); int status = gtpManager.init([String license],(opcodes, subsystem)->{ // Location Init Callback handle });Copy to clipboard **Send request to start location updates** gtpManager.requestNetworkLocationUpdates(minIntervalMillis,location->{ // Location Report Callback handle });Copy to clipboard **Send request to stop location updates** gtpManager.removeNetworkLocationUpdates()Copy to clipboard **Send request to start passive location updates** gtpManager.requestPassiveNetworkLocationUpdates(location->{ // Location Report Callback handle ));Copy to clipboard **Send request to stop passive location updates** gtpManager.removePassiveNetworkLocationUpdates();Copy to clipboard **Request user consent for network positioning** gtpManager.setUserConsent(consentAccepted);Copy to clipboard **Register location capability callback** gtpManager.registerLocationCapabilitiesCallback(isFeatureSupported->{ // Feature Supported Callback handle });Copy to clipboard ## Native **Required includes** #include "qesdk_ndk.h" #include "qesdk_gtp.h"Copy to clipboard **Create GPT Manager instance** GTPManager *gtpManager = new GTPManager(); int ret = gtpManager ->init(licenseStr, license_length,[](uint32_t opcodes, uint32_t *subsystems) { // Callback to handle init events });Copy to clipboard **Send request to start location updates** gtp_LocationStatus ret = gtp_LocationStatus::QESDK_GENERIC_FAILURE; qesdk_transaction_status qesdk_ndk_response = gtpManager->requestNetworkLocationUpdates(min_interval_millis, [](gtp_Location location) { // Location Report Callback handle }, ret); if(qesdk_ndk_response.is_ok()){ // Use the ret value } else { // Can get error code by get_error_code() }Copy to clipboard **Send request stop location updates** qesdk_ndk_response = gtpManager->removeNetworkLocationUpdates(ret); if(qesdk_ndk_response.is_ok()){ // Use the ret value } else { // Can get error code by get_error_code() }Copy to clipboard **Send request to start passive location update**s qesdk_ndk_response = gtpManager->requestPassiveNetworkLocationUpdates( [] (gtp_Location location) { // Location Report Callback handle }), ret); if(qesdk_ndk_response.is_ok()){ // Use the ret value } else { // Can get error code by get_error_code() }Copy to clipboard **Send request to stop passive location updates** qesdk_ndk_response = gtpManager->removePassiveNetworkLocationUpdates(ret); if(qesdk_ndk_response.is_ok()){ // Use the ret value } else { // Can get error code by get_error_code() }Copy to clipboard **Request user consent for network positioning** qesdk_ndk_response = gtpManager->setUserConsent(consent_accepted, ret); if(qesdk_ndk_response.is_ok()){ // Use the ret value } else { // Can get error code by get_error_code() }Copy to clipboard **Register location capability callback** qesdk_ndk_response = gtpManager->registerLocationCapabilitiesCallback([](bool isFeatureSupported){ // Feature Supported Callback handle }, ret); if(qesdk_ndk_response.is_ok()){ // Use the ret value } else { // Can get error code by get_error_code() }Copy to clipboard **Parent Topic:** [GTP](https://docs.qualcomm.com/doc/80-PK177-134/topic/gtp.html) Last Published: Nov 14, 2024 [Previous Topic Location](https://docs.qualcomm.com/bundle/publicresource/80-PK177-134/topics/gtp_location.md) [Next Topic Precise GTP](https://docs.qualcomm.com/bundle/publicresource/80-PK177-134/topics/precise_gtp.md)