Receive the latest in our newsletter. More
Receive the latest in our newsletter. Less
Something went horribly wrong with your application submission. Please try again later.

Glide

Glide

User Guide

Requirements

Mobile


Android: Minimum SDK version: 16

App Configurations

1. Access https://private.codavel.com/

2. Login

a. If you do not have access, please contact your dedicated account manager, he will give you access to the console.


3. Add a new app

a. Go to home and click “NEW APP”

b. Fill in the fields, namely

1. Give the app a name (descriptive)

2. Add the package name (Android) and/or bundle identifier (iOS) of your app. If it doesn’t match with your app, the traffic will be discarded.

3. Choose the App Type CDN to use Codavel Performance Service.

4. Select the regions where you want the Bolina service enabled. If you require other regions, please contact your dedicated account manager.

5. Click in the button CREATE APP


c. Your new app will appear in the list of deployments with the creation status “Processing (Creating deployment…)”. This will take some time, you will receive an email notification when the deployment is ready to use.

4. The deployment is ready to use when the Creation status change to “Deployment ready” and the Bolina server URL is available

5. Click the (?) button in your deployment

6. Take note of both deployment id and secret, you will need them later.

Integration

Integrate Mobile SDK

The integration with Glide can be achieved by integrating Bolina SDK into an existing Glide Module or by importing Bolina’s Glide Module, using OKHTTP as the HTTP engine. That can be done by following this instructions:

1. To add the Bolina Client SDK repository to your project, simply open the app or module's build.gradle and add the following block of code:

repositories {
(...)
 maven { url 'https://artifact.codavel.com:8081/artifactory/android'}
(...)
}

2. Add Bolina’s APP ID and APP SECRET to the app’s build.gradle script:

android {
(...)
defaultConfig {
  (...)
  resValue "string", "BOLINA_DEPLOY_ID", "<APP_ID>"
  resValue "string", "BOLINA_SECRET_ID", "<APP_SECRET>"
  (...)
}
(...)
}

The most recent version, is available in the private area, inside instructions.

3. Add the Bolina Client SDK and OkHTTP client as dependencies of the project, in the app’s build.gradle script (select one of the options below):

a. In case you want to integrate Bolina into an existing Glide Module:

android {
(...)
dependencies {
  (...)
  implementation 'com.codavel.bolina:interceptor_okhttp3:<VERSION>'
  implementation 'com.squareup.okhttp3:okhttp:4.9.0'
  (...)
}

Additionally, add the following lines to your gradle.properties file:

BolinaConfiguration config = new BolinaConfiguration();
config.domainName = "<BOLINA_SERVER_URL>";

b. In case you want to import Bolina’s Glide Module:

android {
(...)
dependencies {
  (...)
  implementation 'com.codavel.bolina:interceptor_glide:<VERSION>'
  implementation 'com.squareup.okhttp3:okhttp:4.9.0'
  (...)
}

4. To enable all functionalities of Codavel’s monitoring solution, Bolina has the following dependencies:

a. In case you have not migrated your app to androidx library artifacts, include the Work Manager by adding the following block of code to the app’s build.gradle script:

dependencies {
    (...)
    implementation "androidx.work:work-runtime:2.2.0"
    (...)
}


b. Bolina also requires the following permissions, that should be added to your app’s manifest:

<manifest . . . >
 <uses-permission android:name="android.permission.INTERNET" />
 <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
</manifest>


5. Make sure that, before performing any HTTP request, you import and start the interceptor:

a. Import Bolina interceptor

import com.codavel.bolina.interceptor.okhttp3.InterceptorSingleton;

b. Initialize the Bolina Configuration and set the Bolina Configuration domain name:

BolinaConfiguration config = new BolinaConfiguration();
config.setDomainName("<BOLINA_SERVER_URL>");

c. [optional] Configure your Origin:

config.addBolinaURLReplacement("<your.cdn.com>", "<your.origin.com>");

d. Start the Bolina interceptor:

InterceptorSingleton.startInterceptor(applicationContext, config);

e. In case you want to integrate Bolina into you Glide App module, add the following code (other options to create the OkHTTP client are available in Other Options to Integrate):

@GlideModule
public final class <YOUR_GLIDE_MODULE> extends LibraryGlideModule {
    @Override
    public void registerComponents(@NonNull Context context, @NonNull Glide glide, @NonNull Registry registry) {
        super.registerComponents(context, glide, registry);

        (...)
        OkHttpClient okHttpClient = CvlOkHttp3.clientBuilderWithBolina().build();
        registry.replace(GlideUrl.class, InputStream.class, new OkHttpUrlLoader.Factory(okHttpClient));

        (...)
    }
    (...)
}


f. Use GlideApp module:

  GlideApp
    .with(myFragment)
    .load(url)
    .centerCrop()
    .placeholder(R.drawable.loading_spinner)
    .into(myImageView);

g. Make sure you stop the interceptor whenever you don’t need it:

...
InterceptorSingleton.getInstance().stopInterceptor()
...

Other Options to Integrate:

  • We provide three different methods to integrate Bolina into a OkHTTP Client:

i. Use a OkHTTP client created and managed by Bolina

import okhttp3.*
import com.codavel.bolina.interceptor.okhttp3.CvlOkHttp3

(...)
OkHttpClient okHttpClient = CvlOkHttp3.clientBuilderWithBolina().build();
(...)


ii. Register Bolina interceptor into your OkHTTP client:

import okhttp3.*
import com.codavel.bolina.interceptor.okhttp3.CvlOkHttp3

(...)
okHttpClient = CvlOkHttp3.registerBolina(okHttpClient);
(...)

iii. Manually add our interceptor into your OkHTTP client, along with Codavel’s network event listener to enable our monitoring solution:

import okhttp3.*
import com.codavel.bolina.interceptor.okhttp3.CvlOkHttp3

(...)
  CvlOkHttp3Interceptor cvlOkHttp3Interceptor = new CvlOkHttp3Interceptor();
  
  OkHttpClient client = new OkHttpClient.Builder()
    (...)
    .eventListenerFactory(new NetworkEventsListener.NetworkEventsListenerFactory(cvlOkHttp3Interceptor))
    .addInterceptor(cvlOkHttp3Interceptor);
    .build();
(...)

Configure Actions in App

Configure actions in App


Bolina SDK can collect the performance data between two points in your app code. This way you can easily compare the network performance of the app requests with and without bolina in a dashboard in your Bolina Performance Console. Bolina SDK provides a method to start the trace of an action, another one to stop the trace, and another one to add optional metadata.


1. When you want to mark the start of an action, add the following line to your code

String action_id = InterceptorSingleton.getInstance().startAction(“open app”, (bolina ? "BOLINA" : "HTTP"));

2. When you want to mark the stop of the same action, add the following line to your code:

InterceptorSingleton.getInstance().stopAction(action_id);

3. When you want to add metadata to the action, add the following lines to your code:

JSONObject metadata = new JSONObject();
metadata.put(“test”,”testing-metadata”);
metadata.put(“test_int”,123);
InterceptorSingleton.getInstance().addActionMetadata(action_id,metadata);

4. When you finish collecting data to the action, add the following line to your code:

InterceptorSingleton.getInstance().processAction(action_id);

Example:

Trace the time to start a video:

1. Call startAction when the user press the play button and give it a name, e.g. “video start”

2. Call stopAction when the video starts playing

3. Call processAction to save the action and send the action stats to your dashboard

Advanced Configurations

Advanced Configurations

Bolina SDK allows the configuration of some advanced settings for enabling some features, configuring security options and increasing the debug level. Please, before changing these settings make sure you know what you are doing. All the methods below are accessible via the BolinaConfiguration object that you need to pass to InterceptorSingleton.startInterceptor()


App settings


  • addBolinaURLReplacement(String originalURLRegex, String bolinaURL) – Adds a new rule to be executed at each HTTP request. If the URL matches the expression configured, then Bolina will replace the matched expression with the configured URL. In case of Bolina fallback, the original URL will be used


  • addFallbackURLReplacement(String bolinaURLRegex, String originalURL) – Adds a new rule to be executed in case of Bolina fallback or performing A/B testing. If the URL used by bolina matches the expression configured, then Bolina will replace the matched expression with the configured URL.

  • setConfigFolder(String configFolder) – Sets the path used by Bolina core to store cached info. Default: application specific cache directory on the filesystem.


A/B Testing setting


  • setUseABTestingPerSession(boolean useABTestingPerSession) – Enables or disables the ab testing per session. This flag changes the behavior of setABTestPercentage. When this flag is set to true, the ab test percentage is calculated per session, otherwise, it is calculated per request. Here we assume a session is a new app start. Default: false

  • setABTestPercentage(int abTestPercentage)  – Sets the percentage of requests or sessions using Bolina. Should be used with setUseABTestingPerSession to define if the ab testing is per session or per request. Default: 100 , meaning all requests or all sessions are using Bolina.

Verbose settings


  • setVerboseLevel(String verboseLevel) – Changes the verbose level of Bolina client. Accepted values: “critical”(less logs), “info”, “debug”, “trace”(more logs). Default: critical


Protocol settings


  • setBolinaHandlerPattern(Pattern bolinaHandlerPattern) – Sets the URLs to be handled via bolina. Any URL that match this pattern will use bolina, on the other hand, a URL that does not match this pattern will be transferred using regular HTTP. default: Pattern.compile(“.*”), meaning all requests are accelerated

  • setCertsEnabled(boolean enableCerts) – Enables/Disable the use of SSL certificates. Default: true.

  • setAllowSelfSignedCerts(boolean allowSelfSignedCerts) – Enables/Disable the use of self signed SSL certificates. We strongly recommend the use of this option only for testing purposes. Default: false.

  • setMaxMemoryAllowed(long maxMemoryAllowed) – Sets the maximum amount of memory used by bolina core. Default: 10MB

  • setZeroRtt(boolean enableZeroRtt) – Enables or disables the use of 0-RTT in Bolina. Default: enabled

  • setTimeToKeepAlive(int timeToKeepAlive) – Sets the maximum time that a connection will be kept alive, in milliseconds. Default: 120s

Insights settings


  • setMonitorPercentage(int monitorPercentage) – Sets the percentage of requests to be traced for detailed statistics in the insights dashboard. A value of 100 means all requests appear in the dashboard. Default: 100

Installation Guide

Infrastructure Overview

Deploy Server Components

User Insights

To get more information about your deployment and the users connected through Codavel Performance Service, we provide an analytics page inside your Codavel account, with data collected from both Servers and Client’s SDKs.

In order to access it, please follow these steps:

1. Login into https://private.codavel.com/

a. If you do not have access, please contact our sales team, they will give you access to the console.

2. Go to the Insights section of the menu.

Network

a. Network – Contains overall HTTP requests information, along with some more detailed and low level statistics.

User

b. User – Contains action information and user behaviour. Note: To view data in this dashboard you need to add action data via SDK. Please see the section Configure Action in App of the respective interceptor.

Debug

c. Debug – Contains detailed information about possible errors that may affect your user experience, that can be used to identify and fix any configuration or deployment issues.

Codavel Open Source Projects.
Want to see examples of open source apps already integrated with Codavel?

access projects
More Cloud Installation Guides