This project contains QuickBlox Android SDK, that includes
- framework library jars
- snippets (shows main use cases of using this one)
- samples (separated samples for each QuickBlox module)
To start work you should just put library jars into your project and call desired methods.
Latest jar-packed framework file you can clone from jars folder.
Android SDK is really simple to use. Just in few minutes you can power your mobile app with huge amount of awesome functions to store, pass and represent your data.
Update your build.gradle file if need.
Eclipse users: If you got 'Unable to execute dex: Java heap size' - try to upgrade eclipse.ini to https://groups.google.com/forum/?fromgroups=#!topic/phonegap/yWePvssyiLE
- Go to AndroidManifest.xml and add
<uses-permission android:name="android.permission.INTERNET" />
inside <manifest>
tag.
The common way to interact with QuickBlox can be presented with following sequence of actions:
- Initialize framework with application credentials
- Create session
- Login with existing user or register new one
- Perform actions with any QuickBlox data entities (users, locations, files, custom objects, pushes etc.)
QBSettings.getInstance().fastConfigInit("961", "PBZxXW3WgGZtFZv", "vvHjRbVFF6mmeyJ");
QBAuth.createSession(new QBEntityCallbackImpl<QBSession>() {
@Override
public void onSuccess(QBSession session, Bundle params) {
// success
}
@Override
public void onError(List<String> errors) {
// errors
}
});
First create (register) new user
// Register new user
final QBUser user = new QBUser("userlogin", "userpassword");
QBUsers.signUp(user, new QBEntityCallbackImpl<QBUser>() {
@Override
public void onSuccess(QBUser user, Bundle args) {
// success
}
@Override
public void onError(List<String> errors) {
// error
}
});
then authorize user
// Login
QBUsers.signIn(user, new QBEntityCallbackImpl<QBUser>() {
@Override
public void onSuccess(QBUser user, Bundle args) {
// success
}
@Override
public void onError(List<String> errors) {
// error
}
});
Create new location for Indiana Jones
double lat = 25.224820; // Somewhere in Africa
double lng = 9.272461;
String statusText = "trying to find adventures";
QBLocation location = new QBLocation(lat, lng, statusText);
QBLocations.createLocation(location, new QBEntityCallbackImpl<QBLocation>() {
@Override
public void onSuccess(QBLocation qbLocation, Bundle args) {
// success
}
@Override
public void onError(List<String> errors) {
// error
}
});
or put Holy Grail into storage
File file = new File("holy_grail.txt");
Boolean fileIsPublic = true;
QBContent.uploadFileTask(file1, fileIsPublic, null, new QBEntityCallbackImpl<QBFile>() {
@Override
public void onSuccess(QBFile qbFile, Bundle params) {
// success
}
@Override
public void onError(List<String> errors) {
// error
}
});
Java Framework provides following jars/services to interact with QuickBlox functions (each service is represented by a model with suite of static methods):
- quickblox-android-sdk-core.jar (contains core, auth and users classes)
- quickblox-android-sdk-chat.jar (contains chat class)
- quickblox-android-sdk-customobjects.jar (contains custom objects class)
- quickblox-android-sdk-location.jar (contains location class)
- quickblox-android-sdk-content.jar (contains content class)
- quickblox-android-sdk-messages.jar (contains messages class)
- quickblox-android-sdk-ratings.jar (contains ratings class)
- quickblox-android-sdk-videochat.jar (contains video chat classes)
- quickblox-android-sdk-videochat-webrtc.jar (contains video chat webrtc classes)