Android Open Source - demo-app-android Demo Application






From Project

Back to project page demo-app-android.

License

The source code is released under:

MIT License

If you think the Android project demo-app-android listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package io.rong.imkit.demo;
// w  ww.j  av  a 2s.c  om
import android.app.Application;
import android.content.Context;
import android.content.Intent;
import android.util.Log;

import java.lang.reflect.Method;

import io.rong.imkit.RongIM;
import io.rong.imlib.RongIMClient;
import io.rong.message.LocationMessage;

/**
 * Created by zhjchen on 14-3-20.
 */
public class DemoApplication extends Application {

    private static final String IS_FIRST = "is_first";
    DemoContext mContext;
    public static final String APP_KEY = "z3v5yqkbv8v30";


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

        /**
         * IMKit SDK????? ????
         * ????????  context???
         * ????????APPKey????????appkey
         * ????????push????????????action????
         * ????????push????????????push??
         */
        RongIM.init(this, APP_KEY, R.drawable.ic_launcher);
        RongIM.setConversationBehaviorListener(new RongIM.ConversationBehaviorListener() {

            @Override
            public boolean onClickUserPortrait(Context context, RongIMClient.ConversationType conversationType, RongIMClient.UserInfo user) {
                Log.d("Begavior", conversationType.getName() + ":" + user.getName());
                Intent in = new Intent(context, UserInfoActivity.class);
                in.putExtra("user_name", user.getName());
                in.putExtra("user_id", user.getUserId());
                context.startActivity(in);
                return false;
            }

            @Override
            public boolean onClickMessage(Context context, RongIMClient.Message message) {

                if (message.getContent() instanceof LocationMessage) {
                    Intent intent = new Intent(context, LocationActivity.class);
                    intent.putExtra("location", message.getContent());
                    context.startActivity(intent);

                }

                Log.d("Begavior", message.getObjectName() + ":" + message.getMessageId());
                return false;
            }
        });


        RongIM.setLocationProvider(new RongIM.LocationProvider() {
            @Override
            public void onStartLocation(final Context context, final LocationCallback callback) {
                DemoContext.getInstance().setLastLocationCallback(callback);
                context.startActivity(new Intent(context, LocationActivity.class));
            }
        });


        mContext = DemoContext.getInstance();
        mContext.init(this);

        try {
            Class c;
            c = Class.forName("com.networkbench.agent.impl.NBSAppAgent");
            Method m = c.getMethod("setLicenseKey", new Class[]{String.class});
            m.invoke(c, new Object[]{"a546c342ba704acf91b27e9603b6860d"});

        } catch (Exception e) {
            e.printStackTrace();
        }

       try {
            System.loadLibrary("imdemo");
        } catch (UnsatisfiedLinkError e) {
//            e.printStackTrace();
        }



        Thread.setDefaultUncaughtExceptionHandler(new DefaultExceptionHandler(this));

    }

}




Java Source Code List

io.rong.imkit.demo.BaseActivity.java
io.rong.imkit.demo.BaseApiActivity.java
io.rong.imkit.demo.BlackListActivity.java
io.rong.imkit.demo.BlackListAdapter.java
io.rong.imkit.demo.DefaultExceptionHandler.java
io.rong.imkit.demo.DemoActivity.java
io.rong.imkit.demo.DemoApplication.java
io.rong.imkit.demo.DemoContext.java
io.rong.imkit.demo.FunctionListAdapter.java
io.rong.imkit.demo.GroupListActivity.java
io.rong.imkit.demo.GroupListAdapter.java
io.rong.imkit.demo.LocationActivity.java
io.rong.imkit.demo.LoginActivity.java
io.rong.imkit.demo.MainActivity.java
io.rong.imkit.demo.ParcelUtils.java
io.rong.imkit.demo.RegisterActivity.java
io.rong.imkit.demo.TestFragment2Activity.java
io.rong.imkit.demo.TestFragmentActivity.java
io.rong.imkit.demo.UserInfoActivity.java
io.rong.imkit.demo.common.DemoApi.java
io.rong.imkit.demo.model.CustomerService.java
io.rong.imkit.demo.model.Status.java
io.rong.imkit.demo.model.User.java
io.rong.imkit.demo.parser.GsonArrayParser.java
io.rong.imkit.demo.parser.GsonParser.java
io.rong.imkit.demo.parser.JsonObjectParser.java
io.rong.imkit.demo.parser.RegisterParser.java
io.rong.imkit.demo.ui.BaseFrameLayout.java
io.rong.imkit.demo.ui.LoadingDialog.java
io.rong.imkit.demo.ui.WinToast.java