# Example code

Source: [https://docs.qualcomm.com/doc/80-PK177-134/topic/wwan_premium_example_code.html](https://docs.qualcomm.com/doc/80-PK177-134/topic/wwan_premium_example_code.html)

This section highlights complete code to make use of WWAN\_PREMIUM subsystem
        APIs.

## Java

**Required imports**

    private IQesdk mQesdkManager;
    private WWANStandardManager mWwanStandardManager;
    private WWANPremiumManager mWwanPremiumManager;Copy to clipboard

**Create the QESDK Manager instance**

    mQesdkManager = IQesdk.createInstance(this);Copy to clipboard

**Create WWANPremiumManager instance**

    mWwanPremiumManager = new WWANPremiumManager(mQesdkManager);Copy to clipboard

**Set up                callbacks**

    private IWWANPremiumCBs.ILocationReportCallback wwanPremiumLocationReportCallback;
    private IWWANPremiumCBs.ILocationReportCallback wwanPremiumPassiveLocationReportCallback;Copy to clipboard

**Send request for GTP or PRECISE\_GTP network location updates as                    required**

    mWwanPremiumManager.requestNetworkLocationUpdates(
            mApiToExecute.minIntervalMillis, 
            wwanPremiumLocationReportCallback);Copy to clipboard

**Receive the network location reports in the registered callback**

## Native

**Required includes**

    #include  "qesdk_ndk.h" 
    #include “qesdk_Location_WWAN_PREMIUM.h"Copy to clipboard

**Create WWANPremiumManager instance**

    wwanPremiumManager = new WWAN_PREMIUMManager (); 
    int ret = wwanPremiumManager->init(licenseStr, license_length, [](uint32_t opcodes, uint32_t *subsystems) {
        // Callback to handle init events
     });
    int ret = rlManager->init(licenseStr, icense_length,[] (uint32_t opcodes, uint32_t *subsystems){
        // Callback to handle init events
    });Copy to clipboard

**Send request to start location                updates**

    qesdk_transaction_status qesdk_ndk_response = wwanPremiumManager->requestNetworkLocationUpdates(min_interval_millis, [](wwan_premium_Location location){
        // Location Report Callback handle 
    }, qsap_api_response);
    
    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 location updates**

    qesdk_transaction_status qesdk_ndk_response = wwanPremiumManager->removeNetworkLocationUpdates(qsap_api_response);
    if(qesdk_ndk_response.is_ok()) {
         // Use the ret value
    }
    else {
         // Can get error code by get_error_code()
    }Copy to clipboard

**Parent Topic:** [WWAN premium](https://docs.qualcomm.com/doc/80-PK177-134/topic/wwan_premium.html)

Last Published: Nov 14, 2024

[Previous Topic
Location](https://docs.qualcomm.com/bundle/publicresource/80-PK177-134/topics/wwan_premium_location.md) [Next Topic
API compatibility table](https://docs.qualcomm.com/bundle/publicresource/80-PK177-134/topics/api_compatability_table.md)