Coder Social home page Coder Social logo

qiscus / qiscus-sdk-android Goto Github PK

View Code? Open in Web Editor NEW
201.0 19.0 84.0 10.81 MB

Qiscus provide everything you need to power up your app with chats. And it's now made simple.

Home Page: https://www.qiscus.com

License: Apache License 2.0

Java 100.00%
chat android-library android-sdk chatting chatbot qiscus qiscus-engine qiscus-sdk chatapp android-chat-sdk

qiscus-sdk-android's Introduction

Introduction

Qiscus Chat SDK (Software Development Kit) is a product provided by Qiscus that enables you to embed an in-app chat/chat feature in your applications quickly and easily. With our chat SDK, you can implement chat feature without dealing with the complexity of real-time communication infrastructure. We provide a powerful API to let you implement chat feature into your apps in the most seamless development process.

Qiscus Chat SDK provides many features such as:

  • 1-on-1 chat
  • Group chat
  • Channel chat
  • Typing indicator
  • Image and file attachment
  • Online presence
  • Delivery receipt
  • Read receipt
  • Delete message
  • Offline message
  • Block user
  • Custom real-time event
  • Server-side integration with Server API and Webhook
  • Embed bot engine in your app
  • Enable push notification
  • Export and import messages from your app

Try Sample App

We have provided a sample app to help you get to know with our chat SDK. This sample app is built with full functionalities so that you can figure out the flow and main activities using Qiscus Chat SDK. Now you can freely customize your own UI. You can also build your own app on top of our sample app. For further details you can download this sample.

git clone https://github.com/qiscus/qiscus-chat-sdk-android-sample.git

This sample app uses sample APP ID, which means, by using this sample app, you will share the data with others. In case you want to try by your own, you can change the APP ID into your own APP ID. You can find your APP ID in your dashboard. Click here to access your dashboard

Getting Started

Step 1: Get Your APP ID

First, you need to create your application in dashboard, by accessing Qiscus Chat Dashboard. You can create more than one App ID.

Step 2: Install Qiscus Chat SDK

Qiscus Chat SDK requires minimum Android API 16 (Jelly Bean). To integrate your app with Qiscus, it can be done in 2 (two) steps. First, you need to add URL reference in your .gradle project. This reference is a guide for .gradle to get Qiscus Chat SDK from the right repository. Below is how to do that:

allprojects { 
      repositories { 
           ... 
           maven { url "https://artifactory.qiscus.com/artifactory/qiscus-library-open-source" } 
      } 
}

Second, you need to add SDK dependencies inside your app .gradle. Then, you need to synchronize to compile the Qiscus Chat SDK for your app.

dependencies { 
       ... 
       implementation 'com.qiscus.sdk:chat-core:1.7.1'
}

Step 3: Initialization Qiscus Chat SDK

You need to initiate your APP ID for your chat app before carry out to authentication. This initialization only needs to be done once in the app lifecycle. Initialization can be implemented in the initial startup. Here is how you can do that:

public class SampleApp extends Application {

    @Override
    public void onCreate() {
        super.onCreate();

        QiscusCore.initWithAppId(this, APPID);

  }
 }

The initialization should be called once across an Android app . The best practice you can put in application class.

Step 4: Authenticate to Qiscus

To use Qiscus Chat SDK features, a user need to authenticate to Qiscus Server, for further detail you might figure out Authentication section. This authentication is done by calling setUser() function. This function will retrieve or create user credential based on the unique userId, for example:

QiscusCore.setUser(userId, userKey)
      .withUsername(username)
      .withAvatarUrl(avatarUrl)
      .withExtras(extras)
      .save(new QiscusCore.SetUserListener() {
          @Override
          public void onSuccess(QiscusAccount qiscusAccount) {
              //on success
          }
          @Override
          public void onError(Throwable throwable) {
              //on error 
      });

Where:

userId (string, unique): A user identifier that will be used to identify a user and used whenever another user need to chat with this user. It can be anything, whether is is user's email, your user database index, etc. As long as it is unique and a string.

userKey (string): userKey for authentication purpose, so even if a stranger knows your user Id, he cannot access the user data.

username (string): Username for display name inside Chat Room purposes.

avatarURL (string, optional): to display user's avatar, fallback to default avatar if not provided.

You can learn from the figure below to understand what really happened when calling setUser() function:



Updating User Profile

After your user account is created, sometimes you may need to update a user information, such as changing user avatar. You can use method QiscusCore.updateUser() to make changes to your account.

QiscusCore.updateUser(userName, avatarUrl, new QiscusCore.SetUserListener() {
            @Override
            public void onSuccess(QiscusAccount qiscusAccount) {
                //do anything after it successfully updated
            }

            @Override
            public void onError(Throwable throwable) {
                //do anything if error occurs
            }
        });

Clear User Data and disconnect

As mentioned in previous section, when you did setUser(), user's data will be stored locally. When user need to disconnect from Qiscus Chat SDK service, you need to clear the user data that is related to Qiscus Chat SDK, such as token, profile, messages, rooms, etc, from local device. You can do this by calling clearUser() method :

QiscusCore.clearUser();

Create Chat Room

Chat Room is a place where 2 or more users can chat each other. There are 3 type of Chat Room that can be created using Qiscus Chat SDK: 1-on-1 Chat Room, Group Chat Room, and Channel. For some cases, a room can be identified by room unique id or room name.

1-on-1 Chat Room

We assume that you already know a targeted user you want to chat with. Make sure that your targeted user has been registered in Qiscus Chat SDK through setUser() method, as explained in the previous section. To start a conversation with your targeted user, it can be done with getChatRoom() method. Qiscus Chat SDK, then, will serve you a new Chat Room, asynchronously. When the room is succesfully created, Qiscus Chat SDK will return a Chat Room package through onSuccess() listener.

QiscusApi.getInstance().chatUser(userId, options)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(chatRoom -> {
                    // on success         
                }, throwable -> {
                    // on error        
                });

Where:

userId: A User identifier that will be used to identify a user and used whenever another user needs to chat with this user. It can be anything, whether is user's email, your user database index, etc. As long as it is unique and a string.

distinctId: (deprecated) you can fill “ ” (empty string).

options: metadata that can be as additional information to Chat Room, which consists key-value, for example, key: background, and value: red.

Group Chat Room

When you want your many users to chat together in a 1-on-1 chat room, you need to create Group Room. Basically Group Room has the same concept as 1-on-1 Chat Room, but the different is that Group Room will target array of userIds in a single method. Here how you can create Group Room:

QiscusApi.getInstance().createGroupChat(roomName, userIds, avatarUrl, options);
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(chatRoom -> {
                    // on success
                }, throwable -> {
                    // on error
                });

Channel

Creating Channel Chat Room is ideal for a use case that requires a lot of number participants, more than 100.

You need to set uniqueId to identify a Channel Chat Room. If a Chat Room with predefined uniqueId doesn't exist, it will create a new one with requester as the only one participant. Otherwise, if Chat Room with predefined uniqueId already exists, it will return that room and add requester as a participant.

When the room doesn't exist at the very first call and you do not send avatarUrl and/or roomName, it will use the default value. But, after the second call (room does exist) and you send avatarUrl and/or roomName, it will be updated to that value. For example the implementation creating channel:

QiscusApi.getInstance().createChannel(uniqueId, roomName, avatarUrl, options)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(chatRoom -> {
                    // on success
                }, throwable -> {
                    // on error
                });

Room Participant Management

In some cases, you may need to add additional participants into your room chat or even removing any participant.

Get Chat Room List

To get all room list you can call QiscusApi.getInstance().getChatRooms(int page, int limit, boolean showMembers), page start from 1, limit indicate the max rooms per page, showMembers is flag for load room members also or not. Here sample code:

QiscusApi.getInstance().getAllChatRooms(showParticipant, showRemoved, showEmpty, page, limit)
    .subscribeOn(Schedulers.io())
    .observeOn(AndroidSchedulers.mainThread())
    .subscribe(chatRooms -> {
        //on success
    }, throwable -> {
        //on error
    });

Add Participant in Chat Room

You can add more than a participant in Chat Room by calling addRoomMember method. You can also pass multiple userIds. Once a participant succeeds to join the Chat Room, they will get a new Chat Room in their Chat Room list.

QiscusApi.getInstance().addParticipants(roomId, userId)
        .subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe(chatRoom -> {
           // on success
        }, throwable -> {
            //on error        
        });

Remove Participant in Chat Room

You can remove more than a participant in Chat Room by calling removeRoomMember method. You can also pass multiple userId. Once a participant is removed from the Chat Room, they will not find related Chat Room in their Chat Room list.

QiscusApi.getInstance().removeParticipants(roomId, userId)
        .subscribeOn(Schedulers.io())
        .observeOn(AndroidSchedulers.mainThread())
        .subscribe(chatRoom -> {
           //success
        }, throwable -> {
            //error        
        });

Enable Push Notification

First install FCM to your apps, you can follow this steps. You can skip this step, if your apps already use FCM. Then put your api key to qiscus dashboard. Now lets integrate with Qiscus client sdk, first enable FCM at Qiscus chat config.

Qiscus.getChatConfig().setEnableFcmPushNotification(true);

After that, you need register FCM token to notify Qiscus Chat SDK, you can call sendCurrentToken() after login and in home page (was login in qiscus), for example:

if (Qiscus.hasSetupUser()) {
    FirebaseUtil.sendCurrentToken();
}
public class FirebaseUtil {

    public static void sendCurrentToken() {
        AppFirebaseMessagingService.getCurrentDeviceToken();
    }
}
  • Add the .AppFirebaseMessagingService in Manifest as well, for example:
<service android:name=".AppFirebaseMessagingService"
         android:exported="true">
    <intent-filter>
        <action android:name="com.google.firebase.MESSAGING_EVENT" />
    </intent-filter>
</service>

Handle Incoming Message From Push Notification

After registering your FCM token, you will get data from FCM Qiscus Chat SDK, you can handle by using handleMessageReceived() method, for example:


import android.util.Log;

import androidx.annotation.NonNull;
import com.google.firebase.messaging.FirebaseMessaging;
import com.google.firebase.messaging.FirebaseMessagingService;
import com.google.firebase.messaging.RemoteMessage;
import com.qiscus.sdk.chat.core.QiscusCore;
import com.qiscus.sdk.chat.core.util.QiscusFirebaseMessagingUtil;

public class AppFirebaseMessagingService extends FirebaseMessagingService {

    @Override
    public void onMessageReceived(RemoteMessage remoteMessage) {
        super.onMessageReceived(remoteMessage);

        Log.d("Qiscus", "onMessageReceived " + remoteMessage.getData().toString());
        if (QiscusFirebaseMessagingUtil.handleMessageReceived(remoteMessage)) {
            return;
        }
    }

    @Override
    public void onNewToken(@NonNull String s) {
        super.onNewToken(s);

        Log.d("Qiscus", "onNewToken " + s);
        QiscusCore.registerDeviceToken(s);
    }

    public static void getCurrentDeviceToken() {
        final String token = QiscusCore.getFcmToken();
        if (token != null) {
            FirebaseMessaging.getInstance().deleteToken()
                    .addOnCompleteListener(task -> {
                        QiscusCore.removeDeviceToken(token);
                        getTokenFcm();
                    })
                    .addOnFailureListener(e -> QiscusCore.registerDeviceToken(token));
        } else {
            getTokenFcm();
        }
    }

    private static void getTokenFcm() {
        FirebaseMessaging.getInstance().getToken()
                .addOnCompleteListener(task -> {
                    if (task.isSuccessful() && task.getResult() != null) {
                        QiscusCore.registerDeviceToken(task.getResult());
                    } else {
                        Log.e("Qiscus", "getCurrentDeviceToken Failed : " +
                                task.getException());
                    }
                });
    }
}

Event Handler

Qiscus Chat SDK provides a simple way to let applications publish and listen to some real-time events. You can publish typing, read, user status, custom event so that you can handle freely in the event handler. This lets you inform users that another participant is actively engaged in communicating with them.

Qiscus Chat SDK is using EventBus for broadcasting event to the entire applications. You can learn more about EventBus on this website. What you need to do is register the object which will receive event from EventBus. You can call it like this:

EventBus.getDefault().register(this);

Once you don't need to listen to the event anymore, you have to unregister the receiver by calling this method:

EventBus.getDefault().unregister(this);

This is an example on how to register an activity to receive event from EventBus:

public class MyActivity extends AppCompatActivity {

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);        
        setContentView(R.layout.activity_my);

        // listen room event
        QiscusPusherApi.getInstance().subscribeChatRoom(qiscusChatRoom);

        // listen user status
        QiscusPusherApi.getInstance().subscribeUserOnlinePresence("userId");
    }

    @Override
    protected void onResume() {
        super.onResume();
        EventBus.getDefault().register(this); // register to EventBus
    }

    @Override
    protected void onPause() {
        super.onPause();
        EventBus.getDefault().unregister(this); // unregister from EventBus
    }

    @Subscribe
    public void onReceiveComment(QiscusCommentReceivedEvent event) {
        event.getQiscusComment(); // to get the comment    
    }

    @Subscribe
    public void onReceiveRoomEvent(QiscusChatRoomEvent roomEvent) {
        switch (roomEvent.getEvent()) {
            case TYPING:
                roomEvent.getRoomId(); // this is the room id                
                roomEvent.getUser(); // this is the qiscus user id                
                roomEvent.isTyping(); // true if the user is typing                
                break;
            case DELIVERED:
                roomEvent.getRoomId(); // this is the room id                
                roomEvent.getUser(); // this is the qiscus user id                
                roomEvent.getCommentId(); // the comment id was delivered                
                break;
            case READ:
                roomEvent.getRoomId(); // this is the room id                
                roomEvent.getUser(); // this is the qiscus user id                
                roomEvent.getCommentId(); // the comment id was read               
                break;
            case CUSTOM:
                //here, you can listen custom event
                roomEvent.getRoomId(); // this is the room id
                roomEvent.getUser(); // this is the qiscus user id
                roomEvent.getEventData(); //event data (JSON)
                break;
        }
    }

    @Subscribe
    public void onUserStatusChanged(QiscusUserStatusEvent event) {
        event.getUser(); // this is the qiscus user id    
        event.isOnline(); // true if user is online    
        event.getLastActive(); // Date of last active user
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();

        // stop listening room event
        QiscusPusherApi.getInstance().unsubsribeChatRoom(qiscusChatRoom);

        // stop listening user status
        QiscusPusherApi.getInstance().unsubscribeUserOnlinePresence("qiscus_user_id");
    }
}

Using Proguard

ProGuard is the most popular optimizer for Java bytecode. It makes your Java and Android applications smaller and faster. Read here for more detail about Proguard. If you are using Proguard in your application, make sure you add Proguard rules of Qiscus from Qiscus Proguard Rules to your Proguard rules.

RXJava Support

For you who prefer to code with RXJava, Qiscus Chat SDK does support RXJava. So, you can do anything as you do with Native Java. For example, to set a user, as has been explained in Basic Authentication section, you can do the same with RXJava. Here an example of how you can set user with it:

// Setup qiscus account with rxjava example
Qiscus.setUser("[email protected]", "password")
      .withUsername("Tony Stark")
      .withAvatarUrl("http://avatar.url.com/handsome.jpg")
      .save()
      .subscribeOn(Schedulers.io())
      .observeOn(AndroidSchedulers.mainThread())
      .subscribe(qiscusAccount -> {
          //do anything if success
      }, throwable -> {
          //do anything if error occurs
      });

qiscus-sdk-android's People

Contributors

adicatur avatar andhikayuana avatar ariefnurputranto avatar asyrofqomaruddin avatar dewianisaist avatar evnpr avatar huseinmuhdhor avatar mmnuradityo avatar piyut avatar rymey avatar tfkbudi avatar yuanasoft avatar zetbaitsu avatar zhulmi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

qiscus-sdk-android's Issues

PendingIntents attached to actions with remote inputs must be mutable

Qiscus Chat SDK (buildIn) 2.31.3

App crashed when chat notification arrived.

Error: PendingIntents attached to actions with remote inputs must be mutable

Stacktrace:
at androidx.core.app.NotificationManagerCompat.notify(NotificationManagerCompat.java:223)
at androidx.core.app.NotificationManagerCompat.notify(NotificationManagerCompat.java:205)
at com.qiscus.sdk.util.QiscusPushNotificationUtil.lambda$pushNotification$6(QiscusPushNotificationUtil.java:344)
at com.qiscus.sdk.util.-$$Lambda$QiscusPushNotificationUtil$uk81Wpi_y-UBE25yWqUnDqr9M24.run(Unknown Source:6)

Please update the buildin sdk to latest version of chat-core.

Upload old chat-core releases to artifactory.qiscus.com

I am getting the following error when trying to install chat-core:1.3.2

> Could not GET 'https://dl.bintray.com/qiscustech/maven/com/qiscus/sdk/chat-core/1.3.2/chat-core-1.3.2.pom';. Received status code 403 from server: Forbidden

Bintray was official deprecated as per the official announcement https://jfrog.com/blog/into-the-sunset-bintray-jcenter-gocenter-and-chartcenter/

In this commit you have moved away from Bintray to Artifactory
7847a5e

The current documentation shows this snippet:

allprojects { 
    repositories {  
         maven { url "https://artifactory.qiscus.com/artifactory/qiscus-library-open-source" } 
    } 
}

However, this URL https://artifactory.qiscus.com/artifactory/qiscus-library-open-source/com/qiscus/sdk/chat-core/ has no releases before 1.3.27. Could you please upload the old releases?

Screen Shot 2021-05-06 at 14 11 58

QiscusApi.getInstance().getChatRoom(roomId) returns nothing

I got no return value from running QiscusApi.getInstance().getChatRoom(roomId). Below is the code that I used.

QiscusApi.getInstance()
                .getChatRoom(id)
                .subscribeOn(Schedulers.io())
                .doOnNext(chatRoom -> QiscusCore.getDataStore().addOrUpdate(chatRoom))
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(onSuccess::call, onError::call);

Support for Glide 4

I got this error every time qiscus try to show a notification. It seems like caused by the Glide ver. 4 that I'm using, since the new Glide library has a slightly different way to call their methods.

FATAL EXCEPTION: main
Process: com.dokterchat.expert, PID: 3736
java.lang.NoSuchMethodError: No virtual method load(Ljava/lang/String;)Lcom/bumptech/glide/DrawableTypeRequest; in class Lcom/bumptech/glide/RequestManager; or its super classes (declaration of 'com.bumptech.glide.RequestManager' appears in /data/app/com.xxx.xxx-1/base.apk:classes55.dex)
at com.qiscus.sdk.util.QiscusPushNotificationUtil.loadAvatar(QiscusPushNotificationUtil.java:117)
at com.qiscus.sdk.util.QiscusPushNotificationUtil.lambda$showPushNotification$1(QiscusPushNotificationUtil.java:108)
at com.qiscus.sdk.util.QiscusPushNotificationUtil$$Lambda$2.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Can't resolve Firebase 11.0.2 Dependencies

With release 2.7.2 and 2.8.0 (What I've used), on Gradle Build, the gradle errors:

Failed to resolve: com.google.firebase:firebase-core:11.0.2
Failed to resolve: com.google.firebase:firebase-messaging:11.0.2

See attached file - Text file representation of my application's (Qiscus Sample App) build.gradle file.

build_gradle.txt

I've also used release 1.19.0 and didn't encounter this issue.

Glide 4 Conflict

Hi qiscus!

i have issue about glide library.. my app is crashes when load image from qiscus.. is there any solution from that issue ?? i used glide 4.

Thank You!

What will be the backend ?

Hi , Its an interesting lib , Thanks . But i have a doubt , Where will be the chat data are stored . Can i use my own server as back-end ? . Hope to hear from you soon

java.lang.ExceptionInInitializerError

Error is encountered in built and generated signed APKs (Issue doesn't occur on debug mode or when running App from Android Studio without generating an APK) on:
Qiscus.init(this, "MY_APP_ID");
Encountered problem in releases:

  • 1.19.1

  • 2.7.2

  • 2.8.0

There's not so much documentation on this error relating to Qiscus. When above initialization line of code is commented out, issue isn't encountered.
Error:
08-14 16:06:11.808 29922-29922/? E/AndroidRuntime: FATAL EXCEPTION: main Process: com.smartapplications.smartapp, PID: 29922 java.lang.ExceptionInInitializerError at com.qiscus.sdk.o.<init>(Unknown Source) at com.qiscus.sdk.a.b(Unknown Source) at com.qiscus.sdk.a.a(Unknown Source) at com.smartapplications.smartapp.SmartApp.onCreate(Unknown Source) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1018) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4994) at android.app.ActivityThread.-wrap1(ActivityThread.java) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1549) at android.os.Handler.dispatchMessage(Handler.java:111) at android.os.Looper.loop(Looper.java:207) at android.app.ActivityThread.main(ActivityThread.java:5763) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679) Caused by: java.lang.RuntimeException: Missing type parameter. at com.google.a.c.a.a(Unknown Source) at com.google.a.c.a.<init>(Unknown Source) at com.google.a.l.<init>(Unknown Source) at com.google.a.k.<clinit>(Unknown Source) at com.qiscus.sdk.o.<init>(Unknown Source)  at com.qiscus.sdk.a.b(Unknown Source)  at com.qiscus.sdk.a.a(Unknown Source)  at com.smartapplications.smartapp.SmartApp.onCreate(Unknown Source)  at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1018)  at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4994)  at android.app.ActivityThread.-wrap1(ActivityThread.java)  at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1549)  at android.os.Handler.dispatchMessage(Handler.java:111)  at android.os.Looper.loop(Looper.java:207)  at android.app.ActivityThread.main(ActivityThread.java:5763)  at java.lang.reflect.Method.invoke(Native Method)  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:789)  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:679) 

Attached is a text file with the log:
ExceptionInInitializerError.txt

My Application Class onCreate() code:


public class SmartApp extends Application {

    public static final String TAG = SmartApp.class.getSimpleName();

    private RequestQueue mRequestQueue;
    private ImageLoader mImageLoader;

    private static SmartApp mInstance;

    @Override
    public void onCreate() {
        super.onCreate();

        Qiscus.init(this, "********"); //  APP_ID hidden

        mInstance = this;

        AppLocker.getInstance().enableAppLock(this);

        codeToEnableBootCompleteReceiver();
    }
. . . . . .
}

Usage of Numeric IDs while creating a chat room

Description:
It has been observed that the application is using numeric IDs while creating a chat room. Benefitting this , if the application is vulnerable to improper authorization vulnerabilities then an attacker can quickly gather the data related to users by enumerating the numeric IDs

Recommendation for our side:
Use UUDI’s instead of numeric ID’s while creating the room.

Database

It would have been best if you could provide option for own database instead of yours

Could not find com.schinizer:rxunfurl:0.2.0

Hello everyone,

When I remove jCenter from my project, the dependencies could not found for following library:

> Could not find com.schinizer:rxunfurl:0.2.0.
    Searched in the following locations:
      - https://dl.google.com/dl/android/maven2/com/schinizer/rxunfurl/0.2.0/rxunfurl-0.2.0.pom
      - https://repo.maven.apache.org/maven2/com/schinizer/rxunfurl/0.2.0/rxunfurl-0.2.0.pom
      - https://jitpack.io/com/schinizer/rxunfurl/0.2.0/rxunfurl-0.2.0.pom
      - https://artifactory.qiscus.com/artifactory/qiscus-library-open-source/com/schinizer/rxunfurl/0.2.0/rxunfurl-0.2.0.pom
      - https://cardinalcommerceprod.jfrog.io/artifactory/android/com/schinizer/rxunfurl/0.2.0/rxunfurl-0.2.0.pom
    Required by:
        project :app > com.qiscus.sdk:chat-core:1.6.0

Force close on notification click

Hello, I just try to create a simple app using qiscus.

When I click on the new chat notification, the app always force closed. The logcat says that the app did not call the setuser method, although it did call the setuser method. Besides, how could the app receive a notification if the setuser method is not called yet ?

I use sdk ver 2.7.2
error happened in android 6 and 7

Following is the error log. Thank you in advance.

FATAL EXCEPTION: main
Process: com.mahasadhu.testchat, PID: 3860
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mahasadhu.testchat/com.qiscus.sdk.ui.QiscusChatActivity}: java.lang.RuntimeException: Please set Qiscus user before start the chatting!
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2646)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707)
at android.app.ActivityThread.-wrap12(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6077)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755)
Caused by: java.lang.RuntimeException: Please set Qiscus user before start the chatting!
at com.qiscus.sdk.Qiscus.checkUserSetup(Qiscus.java:425)
at com.qiscus.sdk.Qiscus.getQiscusAccount(Qiscus.java:224)
at com.qiscus.sdk.ui.QiscusChatActivity.onViewReady(QiscusChatActivity.java:87)
at com.qiscus.sdk.ui.QiscusBaseChatActivity.onCreate(QiscusBaseChatActivity.java:85)
at android.app.Activity.performCreate(Activity.java:6662)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1118)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2599)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2707) 
at android.app.ActivityThread.-wrap12(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1460) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:154) 
at android.app.ActivityThread.main(ActivityThread.java:6077) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:865) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:755) 

New logo

Hi, I am a graphic designer, I want to help others in graphic design.

After I reviewed your project, you have no logo on this project. Therefore I want to contribute to this project by creating a new logo / icon. what do you think?

Send Video

Hi, I'm using your chat application but I don't sent video in chat.
I am trying to send video it as a file and I get error from it.

Insecure Storage of Sensitive Data

Hi Team,

During testing of an application we came to know that they are storing qiscus.cfg.xml files through which some of keys are been disclosed.

In Line #1005 It is also mentioned:
LocalDataManager() {
sharedPreferences = QiscusCore.getApps().getSharedPreferences("qiscus.cfg", Context.MODE_PRIVATE);
gson = new Gson();
token = isLogged() ? getAccountInfo().getToken() : "";

Isn't it a security threat ?
As an attacker can steal the qiscus authorization tokens from here.

Disable extra chat feature

Is it possible to disable extra feature such as send file entirely? So when a new chatroom is created there's no Request permissions dialog.

Crash Possibility : java.lang.IllegalStateException: Apps may not schedule more than 100 distinct jobs

JobInfo jobInfo = new JobInfo.Builder(qiscusAccount.getId() + randomValue, componentName)

Qiscus SDK is creating new job ids whenever this service is called this will add new jobs every time in the job queue which will lead to this possible crash.

https://samebug.io/exceptions/2449713/java.lang.IllegalStateException/apps-may-not-schedule-more-than-100

Error: Program type already present: android.arch.lifecycle.ViewModelStore

I am getting this error after including qiscus in me existing project. I thought it was conflict of glide so I tried to exclude glide by using:
implementation ('com.qiscus.sdk:chat-core:1.2.12'){
exclude group: 'com.github.bumptech.glide', module: 'glide'
}

but still I am getting same error my current dependecies are as follow:

implementation fileTree(include: ['*.jar'], dir: 'libs')
//Chat dependencies
implementation ('com.qiscus.sdk:chat-core:1.2.12'){
exclude group: 'com.github.bumptech.glide', module: 'glide'
}
//noinspection GradleCompatible
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:cardview-v7:28.0.0'
implementation 'com.google.android.gms:play-services-maps:15.0.1'
implementation 'com.google.android.gms:play-services-places:15.0.1'
implementation 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'
//noinspection GradleCompatible
implementation 'com.google.firebase:firebase-auth:16.0.5'
implementation 'com.google.android.gms:play-services-auth:16.0.1'
implementation 'com.google.firebase:firebase-database:16.0.4'
implementation 'com.google.firebase:firebase-core:16.0.5'
implementation 'com.google.firebase:firebase-storage:16.0.4'
implementation 'com.firebaseui:firebase-ui-database:3.1.1'
implementation 'com.google.firebase:firebase-messaging:17.3.4'
implementation 'com.google.firebase:firebase-dynamic-links:16.1.3'
implementation 'com.crashlytics.sdk.android:crashlytics:2.9.5'
implementation 'com.android.support:support-annotations:27.1.1'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.jakewharton:butterknife:8.8.1'
annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.github.bumptech.glide:glide:4.8.0'
annotationProcessor 'com.github.bumptech.glide:compiler:4.8.0'

implementation 'de.hdodenhof:circleimageview:2.2.0'
implementation 'com.android.support:multidex:1.0.3'
implementation 'com.jsibbold:zoomage:1.1.0-SNAPSHOT'
implementation 'com.facebook.android:facebook-login:4.34.0'
implementation 'com.squareup.picasso:picasso:2.71828'
implementation 'org.greenrobot:eventbus:3.1.1'
implementation 'com.firebase:geofire-android:2.3.1'
implementation 'com.github.greenfrvr:hashtag-view:1.3.1'
implementation 'com.davemorrissey.labs:subsampling-scale-image-view:3.10.0'
implementation 'me.saket:better-link-movement-method:2.2.0'
implementation 'org.ocpsoft.prettytime:prettytime:4.0.1.Final'
implementation 'com.squareup.okhttp:okhttp:2.6.0'
implementation 'com.squareup.retrofit:retrofit:1.9.0'
implementation 'com.squareup.okhttp3:logging-interceptor:3.3.1'
implementation 'com.squareup.okhttp3:okhttp:3.8.1'
implementation 'com.jakewharton.retrofit:retrofit1-okhttp3-client:1.0.2'

implementation 'id.zelory:compressor:2.1.0'
implementation 'joda-time:joda-time:2.10.1'

implementation('com.google.api-client:google-api-client-android:1.20.0') {
    exclude module: 'guava-jdk5'
}

can you please give me any solution for this issue?

Back button on chat view

untitled

I wonder if i'm the only one but I seem to click everytime next to the back button, giving me the feel like the app is not responsive.

java.lang.NoClassDefFoundError: com.vanniktech.emoji.one.EmojiOneProvider Against Android API 19 (4.4.2)

I encountered the following error as I tested version 2.8.0 against Android API 19 - 4.4.2. (com.qiscus.sdk:chat:2.8.0)

This error occurs at line:
Qiscus.init(this, "MY_APP_ID");

Error Log:
FATAL EXCEPTION: main Process: com.smartapplications.smartapp, PID: 27042 java.lang.NoClassDefFoundError: com.vanniktech.emoji.one.EmojiOneProvider at com.qiscus.sdk.Qiscus.initWithCustomServer(Qiscus.java:138) at com.qiscus.sdk.Qiscus.init(Qiscus.java:98) at com.smartapplications.smartapp.SmartApp.onCreate(SmartApp.java:37) at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1007) at android.app.ActivityThread.handleBindApplication(ActivityThread.java:4582) at android.app.ActivityThread.access$1500(ActivityThread.java:151) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1402) at android.os.Handler.dispatchMessage(Handler.java:110) at android.os.Looper.loop(Looper.java:193) at android.app.ActivityThread.main(ActivityThread.java:5333) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:515) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:829) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:645) at dalvik.system.NativeStart.main(Native Method)

NullPointerException at QiscusSyncJobService.java:143

I meet this issue for a long time, even after upgrade to the latest qiscusCore version 1.3.30
qiscus crash
crash info
I've looked at the SDK source code and saw this line got crashed:
private void stopSync() { if (timer != null) { timer.cancel(); timer.purge(); timer = null; } }
The stopSync only got called in log out and onDestroy service.
In fact, this release note should fix that issue https://github.com/qiscus/qiscus-sdk-android/releases/tag/1.3.20 but I'm using 1.3.30 and it still occurred.

Upgrade to RxJava 2.0

Please upgrade your RxJava version. Because it's too obsolete to use RxJava 1 today.
Thank you!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.