Googl Shortener Library

A Simple Android Library to shorten urls with Goo.gl

Лицензия

Лицензия

Группа

Группа

com.andreabaccega
Идентификатор

Идентификатор

googlshortenerlib
Последняя версия

Последняя версия

1.0.0
Дата

Дата

Тип

Тип

aar
Описание

Описание

Googl Shortener Library
A Simple Android Library to shorten urls with Goo.gl
Ссылка на сайт

Ссылка на сайт

https://github.com/vekexasia/android-googl-shortener-lib
Система контроля версий

Система контроля версий

https://github.com/vekexasia/android-googl-shortener-lib

Скачать googlshortenerlib

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.andreabaccega/googlshortenerlib/ -->
<dependency>
    <groupId>com.andreabaccega</groupId>
    <artifactId>googlshortenerlib</artifactId>
    <version>1.0.0</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.andreabaccega/googlshortenerlib/
implementation 'com.andreabaccega:googlshortenerlib:1.0.0'
// https://jarcasting.com/artifacts/com.andreabaccega/googlshortenerlib/
implementation ("com.andreabaccega:googlshortenerlib:1.0.0")
'com.andreabaccega:googlshortenerlib:aar:1.0.0'
<dependency org="com.andreabaccega" name="googlshortenerlib" rev="1.0.0">
  <artifact name="googlshortenerlib" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.andreabaccega', module='googlshortenerlib', version='1.0.0')
)
libraryDependencies += "com.andreabaccega" % "googlshortenerlib" % "1.0.0"
[com.andreabaccega/googlshortenerlib "1.0.0"]

Зависимости

compile (2)

Идентификатор библиотеки Тип Версия
com.squareup.okhttp : okhttp jar 2.0.0
com.google.code.gson : gson jar 2.3

Модули Проекта

Данный проект не имеет модулей.

Android Goo.gl Shortener Library

A simple tested Android library to shorten long urls in your app!

How to include it

This library can be found in maven central repo. If you're using Android studio you can include it by writing the following in the corresponding dependencies block

Gradle:

dependencies {
	// ...
	compile 'com.andreabaccega:googlshortenerlib:1.0.0'
	// ...
}

####Maven

		<dependency>
			<groupId>com.andreabaccega</groupId>
			<artifactId>googlshortenerlib</artifactId>
			<version>${version}</version>
			<type>aar</type>
			<scope>provided</scope>
		</dependency>

How to use

	GoogleShortenerPerformer shortener = new GoogleShortenerPerformer(new OkHttpClient());

	String longUrl = "http://www.andreabaccega.com/";

	GooglShortenerResult result = shortener.shortenUrl(
		new GooglShortenerRequestBuilder()
			.buildRequest(longUrl)
		);

	if ( Status.SUCCESS.equals(result.getStatus()) ) {
		// all ok result.getShortenedUrl() contains the shortened url!
	} else if ( Status.IO_EXCEPTION.equals(result.getStatus()) ) {
		// connectivity error. result.getException() returns the thrown exception while performing
		// the request to google servers!
	} else {
		// Status.RESPONSE_ERROR
		// this happens if google replies with an unexpected response or if there are some other issues processing
		// the result.

		// result.getException() contains a GooglShortenerException containing a message that can help resolve the issue!
	}

We do recommend to request an apiKey and use the following method instead of the above!

	new GooglShortenerRequestBuilder()
			.buildRequest(
				longUrl,
				apiKey)
		)

Dependencies

This library depends on the following artifacts:

  • com.squareup.okhttp:okhttp:2.0.0
  • com.google.code.gson:gson:2.3

They're automatically resolved by gradle but you can always exclude them (if you're using another compatible version) by doing so:

dependencies {
	// ...
	compile ('com.andreabaccega:googlshortenerlib:1.0.0') {
		exclude module: 'okhttp'
		exclude module: 'gson'
	}
	// ...
}

Author

Версии библиотеки

Версия
1.0.0