请选择 进入手机版 | 继续访问电脑版

技术控

    今日:35| 主题:61447
收藏本版 (1)
最新软件应用技术尽在掌握

[其他] Qiscus SDK

[复制链接]
言语间的敷衍 发表于 2016-10-3 07:53:42
437 6
Qiscus SDK

   

Qiscus SDK

Qiscus SDK-1-技术控-Qiscus,Throwable,License,QiscusAccount,Intent

Qiscus SDK

Qiscus SDK-2-技术控-Qiscus,Throwable,License,QiscusAccount,Intent

  Qiscus SDK is a lightweight and powerful android chat library. Qiscus SDK will allow you to easily integrating Qiscus engine with your apps to make cool chatting application.
  Instalation

  Add to your project build.gradle
  1. allprojects {
  2.     repositories {
  3.         .....
  4.         maven { url "https://jitpack.io" }
  5.         maven { url 'http://clojars.org/repo' }
  6.     }
  7. }
复制代码
Then add to your app module build.gradle
  1. dependencies {
  2.     compile 'com.github.qiscus:qiscus-sdk-android:1.6.0'
  3. }
复制代码
Let's make cools chatting apps!

  Init Qiscus

  Init Qiscus at your application class
  1. public class SampleApps extends Application {
  2.     @Override
  3.     public void onCreate() {
  4.         super.onCreate();
  5.         Qiscus.init(this, "yourQiscusAppId");
  6.     }
  7. }
复制代码
Login to Qiscus engine

  Before user can start chatting each other, they must login to qiscus engine.
  1. Qiscus.setUser("[email protected]", "userKey")
  2.       .withUsername("Tony Stark")
  3.       .withAvatarUrl("http://avatar.url.com/handsome.jpg")
  4.       .save(new Qiscus.SetUserListener() {
  5.           @Override
  6.           public void onSuccess(QiscusAccount qiscusAccount) {
  7.               DataManager.saveQiscusAccount(qiscusAccount);
  8.               startActivity(new Intent(this, ConsultationListActivity.class));
  9.           }
  10.           @Override
  11.           public void onError(Throwable throwable) {
  12.               throwable.printStackTrace();
  13.               showError(throwable.getMessage());
  14.           }
  15.       });
复制代码
Start the chatting

  1. Qiscus.buildChatWith("[email protected]")
  2.       .withTitle("Jhon Doe")
  3.       .build(this, new Qiscus.ChatActivityBuilderListener() {
  4.           @Override
  5.           public void onSuccess(Intent intent) {
  6.               startActivity(intent);
  7.           }
  8.           @Override
  9.           public void onError(Throwable throwable) {
  10.               throwable.printStackTrace();
  11.               showError(throwable.getMessage());
  12.           }
  13.       });
复制代码
Customize the chat UI

  Boring with default template? You can customized it, try it!, we have more items than those below code, its just example.
  1. Qiscus.getChatConfig()
  2.       .setStatusBarColor(R.color.blue)
  3.       .setAppBarColor(R.color.red)
  4.       .setTitleColor(R.color.white)
  5.       .setLeftBubbleColor(R.color.green)
  6.       .setRightBubbleColor(R.color.yellow)
  7.       .setRightBubbleTextColor(R.color.white)
  8.       .setRightBubbleTimeColor(R.color.grey)
  9.       .setTimeFormat(date -> new SimpleDateFormat("HH:mm").format(date));
复制代码
Advanced Chat Customizing

   Check CustomChatActivity.java
   

Qiscus SDK

Qiscus SDK-3-技术控-Qiscus,Throwable,License,QiscusAccount,Intent

Qiscus SDK

Qiscus SDK-4-技术控-Qiscus,Throwable,License,QiscusAccount,Intent

Qiscus SDK

Qiscus SDK-5-技术控-Qiscus,Throwable,License,QiscusAccount,Intent

  RxJava Support

  1. // Setup qiscus account with rxjava example
  2. Qiscus.setUser("[email protected]", "password")
  3.       .withUsername("Tony Stark")
  4.       .withAvatarUrl("http://avatar.url.com/handsome.jpg")
  5.       .save()
  6.       .subscribeOn(Schedulers.io())
  7.       .observeOn(AndroidSchedulers.mainThread())
  8.       .subscribe(qiscusAccount -> {
  9.           DataManager.saveQiscusAccount(qiscusAccount);
  10.           startActivity(new Intent(this, ConsultationListActivity.class));
  11.       }, throwable -> {
  12.           throwable.printStackTrace();
  13.           showError(throwable.getMessage());
  14.       });
  15. // Start a chat activity with rxjava example      
  16. Qiscus.buildChatWith("[email protected]")
  17.       .withTitle("Jhon Doe")
  18.       .build(this)
  19.       .subscribeOn(Schedulers.io())
  20.       .observeOn(AndroidSchedulers.mainThread())
  21.       .subscribe(intent -> {
  22.           startActivity(intent);
  23.       }, throwable -> {
  24.           throwable.printStackTrace();
  25.           showError(throwable.getMessage());
  26.       });
复制代码
  Check sample apps -> DragonFly
  License

  1. Copyright (c) 2016 Qiscus.
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5.    http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.
复制代码
灵薇 发表于 2016-10-3 23:06:02
辛苦了言语间的敷衍,天天准时
回复 支持 反对

使用道具 举报

她很可爱o 发表于 2016-10-28 21:08:33
我是一个有名望的恶棍…
回复 支持 反对

使用道具 举报

wangkangaa 发表于 2016-11-5 17:44:36
说不通啊,楼下的你说咋办?
回复 支持 反对

使用道具 举报

周金平 发表于 2016-11-15 17:54:41
楼主这么可爱,你造么?
回复 支持 反对

使用道具 举报

如南 发表于 2016-11-16 07:47:47
好帖必须得顶起
回复 支持 反对

使用道具 举报

兰燊 发表于 2016-11-17 16:51:32
我和我的小伙伴都惊呆了!
回复 支持 反对

使用道具 举报

我要投稿

推荐阅读


回页顶回复上一篇下一篇回列表
手机版/c.CoLaBug.com ( 粤ICP备05003221号 | 文网文[2010]257号 | 粤公网安备 44010402000842号 )

© 2001-2017 Comsenz Inc.

返回顶部 返回列表