Speedify SDK for Android 15.5.0
Loading...
Searching...
No Matches
SpeedifyHandler Class Reference

Default ISpeedifyHandler Implementation. More...

Inheritance diagram for SpeedifyHandler:
ISpeedifyHandler ISdkStateReceiver IForegroundServiceReceiver IWebsocketIPCReceiver INetworkSharingReceiver IForegroundServiceStateReceiver IForegroundNotificationReceiver

Public Member Functions

void OnServiceCreate (@NonNull Service service)
 Callback for vpn service OnCreate.
 
void OnServiceDestroy (@NonNull Service service)
 Callback for vpn service OnDestroy.
 
void OnServiceRemoved (@NonNull Service service)
 Callback for vpn service OnRemoved.
 
void OnServiceCreate ()
 Callback for vpn service OnCreate.
 
void OnServiceDestroy ()
 Callback for vpn service OnDestroy.
 
void OnServiceRemoved ()
 Callback for vpn service OnRemoved.
 
void UpdateForegroundNotification (@NonNull Service service, @NonNull IForegroundNotificationReceiver.ServiceData serviceData)
 Update the foreground notification for the service.
 
final void setServiceNotificationLaunchIntent (@Nullable Intent intent)
 Sets the Intent used when use clicks the service foreground notification.
 
final void setServiceNotificationIcon (int drawableId)
 Sets the icon used by the service foreground notification.
 
final void setServiceNotificationKillswitchVibeEnabled (boolean enabled)
 Sets whether a vibration is triggered when entering killswitch mode.
 
void HideForegroundNotification (@NonNull Service service)
 Callback when vpn service task is removed.
 
void OnServiceRestart (State lastState, RestartReason reason)
 Callback when vpn service restarts after a crash, an application update, or any other unclean shutdown.
 
void OnServiceRestart (State lastState)
 Callback when vpn service restarts after a crash, an application update, or any other unclean shutdown.
 
void OnNewAdapter (@NonNull String adapterID, NetworkType type)
 Notification for the first time seeing a new adapter.
 
void OnAdapterOverlimit (@NonNull String adapterID, NetworkType type, @NonNull AdapterUsageData usageData)
 Notification when an adapter is near its daily or monthly data usage limit.
 
void OnLockedSetting (@NonNull String settingAction, SettingsLockReason lockReason)
 Called in response to attempt to change a setting that is locked by the server.
 
void OnSettingError (@NonNull String settingAction, ErrorType errorType, @Nullable String message)
 Called in response to an error changing a setting.
 
void OnConnectedServer (ServerInformationDetailed serverInfo)
 Connected update received.
 
void OnConnectedServer (ServerInformation serverInfo)
 Connected update received.
 
- Public Member Functions inherited from ISdkStateReceiver
default void OnLoginError (ErrorType errorType, @Nullable String message)
 Error when logging in.
 
default void OnActivationCode (ErrorType errorType, @Nullable String message, @NonNull String activationCode, @NonNull String activationUrl)
 Activation code result.
 
default void OnConnectError (ErrorType errorType, @Nullable String message)
 Error when connecting to a server.
 
default void OnState (State state)
 State update received.
 
default void OnConnectedServer (@Nullable ServerInformation serverInfo)
 Connected update received.
 
default void OnAdaptersList (@NonNull List< AdapterData > adapters)
 Network adapters list update received.
 
default void OnDirectory (@NonNull List< ServerInformation > servers)
 Directory update received This list can be refreshed with refreshDirectory.
 
default void OnConnectionStats (@NonNull ConnectionStatsGroup tunnelStats)
 Latest tunnel stats update.
 
default void OnConnectionStats (@NonNull List< ConnectionStatsGroup > tunnelStats)
 Historic tunnel stats update.
 
default void OnSessionStats (@NonNull SessionStatPeriods stats)
 Session stats update.
 
default void OnStreamingStats (StreamingStats stats)
 Streaming stats update.
 
default void OnSettings (@NonNull Settings settings)
 Notification on settings change.
 
default void OnAccountingData (@NonNull AccountingData accounting)
 Accounting data update This can be refreshed with refreshAccounting.
 
default void OnPrivacySettings (@NonNull PrivacySettings privacy)
 Privacy settings update This can be refreshed with refreshPrivacy.
 
default void OnDirectorySettings (@NonNull DirectorySettings directorySettings)
 Directory settings update This can be refreshed with refreshDirectorySettings.
 
default void OnAccountCheckResult (ErrorType errorType, @Nullable String errorMessage, boolean accountExists)
 Account check result.
 
default void OnAccountCreateResult (ErrorType errorType, @Nullable String errorMessage)
 Account create result.
 
default void OnPasswordChangeResult (ErrorType errorType, @Nullable String errorMessage)
 Password change result.
 
default void OnTorrentDetection (boolean willDisconnect)
 A torrent use was detected.
 
default void OnNonVPNApplications (@NonNull List< String > nonVpnApps)
 List of apps configured to go around the VPN.
 
default void OnLocalVendorSettings (@Nullable JSONObject settings)
 Local vendor settings update.
 
default void OnRemoteVendorSettings (@Nullable JSONObject settings)
 Remote vendor settings update.
 
default void OnVendorUserData (@Nullable String userData)
 Vendor user data update.
 
default void OnLocalProxySettings (@NonNull LocalProxySettings settings)
 Local proxy settings update.
 
default void OnFirewallSettings (@NonNull FirewallSettings settings)
 Firewall settings update.
 
default void OnStreamingSettings (@NonNull StreamingSettings settings)
 Streaming settings update.
 
default void OnLocalProxyDomainWatchlistHit (@Nullable String title)
 Called when a domain from a disabled localproxy domainwatchlist is detected.
 
default void OnCaptivePortals (@NonNull List< String > networks)
 Called when captive portals are detected.
 
default void OnServerSettings (@NonNull ServerSettings settings)
 Server settings update.
 
default void OnVPNPermissionResult (boolean hasPermission)
 Result of request for VPN permission.
 
default void OnLastDisconnectEvent (@NonNull DisconnectEvent lastDisconnectEvent)
 Result of request for the last disconnect event.
 
default void OnLogSettings (@NonNull DaemonLogSettings daemon)
 Log settings result.
 
default void OnSpeedTestResults (@NonNull List< SpeedTestResultData > results)
 Speed test result data.
 
default void OnLogReportResult (ErrorType errorType, @Nullable String message, @Nullable String ticketId)
 Result of a log report request.
 
- Public Member Functions inherited from INetworkSharingReceiver
default void OnNetworkSharingSettings (NetworkSharing.Settings settings)
 Network sharing settings.
 
default void OnNetworkSharingDiscovery (boolean discoveryActive)
 Network sharing discovery state.
 
default void OnNetworkSharesAvailable (List< NetworkSharing.Peer > availableShares)
 Available network shares.
 
default void OnNetworkSharingPeerStatusChange (NetworkSharing.PeerRole role, NetworkSharing.PeerUuid uuid, NetworkSharing.PeerStatus peerStatus, NetworkSharing.TunnelStatus tunnelStatus, ErrorType errorType, String errorMessage)
 state changes and connection errors with peers
 
default void OnNetworkSharingPairRequest (NetworkSharing.PeerUuid uuid, String displayName)
 Event when a peer requests a pairing.
 
default void OnNetworkSharingNewPeerAvailable (NetworkSharing.PeerUuid uuid, String displayName)
 Event when a new peer is available.
 
- Public Member Functions inherited from IForegroundServiceStateReceiver
default boolean OnServiceStartError ()
 Error starting the vpn service.
 
default boolean OnServiceInterruptedError ()
 Error when another VPN starts, interrupting Speedify.
 
- Public Member Functions inherited from IForegroundNotificationReceiver
void UpdateForegroundNotification (@NonNull Service service, @NonNull ServiceData serviceData)
 Callback to show a notification of the service state.
 
- Public Member Functions inherited from IWebsocketIPCReceiver
default void OnWebsocketCreate ()
 Callback on websocket service's OnCreate.
 

Static Public Attributes

static final int SPEEDIFY_FOREGROUND_NOTIFICATION_ID = 55501
 Notification ID used for the foreground service's notification.
 
static final String SPEEDIFY_FOREGROUND_CHANNEL_ID = "VPN"
 Channel ID used for the foreground service's notification.
 

Detailed Description

Default ISpeedifyHandler Implementation.

Extend from this.

Member Function Documentation

◆ HideForegroundNotification()

void HideForegroundNotification ( @NonNull Service service)

Callback when vpn service task is removed.

If overriding UpdateForegroundNotification, use this to hide your notification. Called from secondary (:vpnservice) process.

Parameters
serviceReference to the vpn service
Since
5.6

Implements IForegroundNotificationReceiver.

◆ OnAdapterOverlimit()

void OnAdapterOverlimit ( @NonNull String adapterID,
NetworkType type,
@NonNull AdapterUsageData usageData )

Notification when an adapter is near its daily or monthly data usage limit.

This is called at 75% and 100% usage. You must call handleAdapterOverlimit on SpeedifySDK to clear this message. SpeedifyHandler's default implemenation does this automatically.

Parameters
adapterIDID of the adapter
typetype of the adapter
usageDatainformation on current usage of the adapter
Since
5.8

Implements ISdkStateReceiver.

◆ OnConnectedServer() [1/2]

void OnConnectedServer ( ServerInformation serverInfo)

Connected update received.

Send on start of connection attempt and connection completion.

Parameters
serverInfocurrently connected server
Since
14.0

◆ OnConnectedServer() [2/2]

void OnConnectedServer ( ServerInformationDetailed serverInfo)

Connected update received.

Send on start of connection attempt and connection completion.

Parameters
serverInfocurrently connected server
Deprecated
As of 14.0. Use OnConnectedServer(ServerInformation)

◆ OnLockedSetting()

void OnLockedSetting ( @NonNull String settingAction,
SettingsLockReason lockReason )

Called in response to attempt to change a setting that is locked by the server.

Parameters
settingActionstring identifying the setting that is locked
lockReasonthe reason for the lock
Deprecated
As of 14.0. Use OnSettingError(String,ErrorType,String)

◆ OnNewAdapter()

void OnNewAdapter ( @NonNull String adapterID,
NetworkType type )

Notification for the first time seeing a new adapter.

You must call handleNewAdapter on SpeedifySDK to clear this message. SpeedifyHandler's default implemenation does this automatically.

Parameters
adapterIDID of the adapter
typetype of the adapter
Since
7.3

Implements ISdkStateReceiver.

◆ OnServiceCreate() [1/2]

void OnServiceCreate ( )

Callback for vpn service OnCreate.

Called from secondary (:vpnservice) process.

Since
5.6
Deprecated
as of 14.0. use OnServiceCreate(Service) instead

◆ OnServiceCreate() [2/2]

void OnServiceCreate ( @NonNull Service service)

Callback for vpn service OnCreate.

Called from secondary (:vpnservice) process.

Since
14.0

Implements IForegroundServiceStateReceiver.

◆ OnServiceDestroy() [1/2]

void OnServiceDestroy ( )

Callback for vpn service OnDestroy.

Called from secondary (:vpnservice) process.

Since
5.6
Deprecated
as of 14.0. use OnServiceDestroy(Service) instead

◆ OnServiceDestroy() [2/2]

void OnServiceDestroy ( @NonNull Service service)

Callback for vpn service OnDestroy.

Called from secondary (:vpnservice) process.

Since
14.0

Implements IForegroundServiceStateReceiver.

◆ OnServiceRemoved() [1/2]

void OnServiceRemoved ( )

Callback for vpn service OnRemoved.

Called from secondary (:vpnservice) process.

Since
5.6
Deprecated
as of 14.0. use OnServiceRemoved(Service) instead

◆ OnServiceRemoved() [2/2]

void OnServiceRemoved ( @NonNull Service service)

Callback for vpn service OnRemoved.

Called from secondary (:vpnservice) process.

Since
14.0

Implements IForegroundServiceStateReceiver.

◆ OnServiceRestart() [1/2]

void OnServiceRestart ( State lastState)

Callback when vpn service restarts after a crash, an application update, or any other unclean shutdown.

Called from secondary (:vpnservice) process.

Parameters
lastStatethe last known vpn state
Since
14.8

Implements IForegroundServiceStateReceiver.

◆ OnServiceRestart() [2/2]

void OnServiceRestart ( State lastState,
RestartReason reason )

Callback when vpn service restarts after a crash, an application update, or any other unclean shutdown.

Called from secondary (:vpnservice) process.

Parameters
lastStatethe last known vpn state
reasonreason for the restart
Since
10.4
Deprecated
as of 14.8. Use OnServiceRestart(State) and/or OnLastDisconnectEvent(DisconnectEvent)

◆ OnSettingError()

void OnSettingError ( @NonNull String settingAction,
ErrorType errorType,
@Nullable String message )

Called in response to an error changing a setting.

Parameters
settingActionstring identifying the setting that failed to change
errorTypetype of error
messageerror message
Since
14.0

Implements ISdkStateReceiver.

◆ setServiceNotificationIcon()

final void setServiceNotificationIcon ( int drawableId)

Sets the icon used by the service foreground notification.

This defaults to a drawable resource named speedify_notification_icon.

Parameters
drawableIdresource id of the drawable to use
Since
12.0

◆ setServiceNotificationKillswitchVibeEnabled()

final void setServiceNotificationKillswitchVibeEnabled ( boolean enabled)

Sets whether a vibration is triggered when entering killswitch mode.

This defaults to true.

Parameters
enabledif vibration is enabled
Since
12.0

◆ setServiceNotificationLaunchIntent()

final void setServiceNotificationLaunchIntent ( @Nullable Intent intent)

Sets the Intent used when use clicks the service foreground notification.

This defaults to the application's default launcher intent.

Parameters
intentIntent launched when clicking default foreground notification
Since
12.0

◆ UpdateForegroundNotification()

void UpdateForegroundNotification ( @NonNull Service service,
@NonNull IForegroundNotificationReceiver.ServiceData serviceData )

Update the foreground notification for the service.

Called from secondary (:vpnservice) process.

Parameters
servicethe service to update the notification for
serviceDatathe data to use for the notification
Since
14.0

Member Data Documentation

◆ SPEEDIFY_FOREGROUND_CHANNEL_ID

final String SPEEDIFY_FOREGROUND_CHANNEL_ID = "VPN"
static

Channel ID used for the foreground service's notification.

This cannot be overridden.

Since
11.7

◆ SPEEDIFY_FOREGROUND_NOTIFICATION_ID

final int SPEEDIFY_FOREGROUND_NOTIFICATION_ID = 55501
static

Notification ID used for the foreground service's notification.

This cannot be overridden.

Since
11.7

The documentation for this class was generated from the following file: