当前位置: 首页>>代码示例>>Java>>正文


Java AVOSCloud类代码示例

本文整理汇总了Java中com.avos.avoscloud.AVOSCloud的典型用法代码示例。如果您正苦于以下问题:Java AVOSCloud类的具体用法?Java AVOSCloud怎么用?Java AVOSCloud使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AVOSCloud类属于com.avos.avoscloud包,在下文中一共展示了AVOSCloud类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: init

import com.avos.avoscloud.AVOSCloud; //导入依赖的package包/类
/**
 * 初始化 LeanCloudChatKit,此函数要在 Application 的 onCreate 中调用
 *
 * @param context
 * @param appId
 * @param appKey
 */
public void init(Context context, String appId, String appKey) {
    if (TextUtils.isEmpty(appId)) {
        throw new IllegalArgumentException("appId can not be empty!");
    }
    if (TextUtils.isEmpty(appKey)) {
        throw new IllegalArgumentException("appKey can not be empty!");
    }

    AVOSCloud.initialize(context.getApplicationContext(), appId, appKey);

    // 消息处理 handler
    AVIMMessageManager.registerMessageHandler(AVIMTypedMessage.class, new LCIMMessageHandler(context));

    // 与网络相关的 handler
    AVIMClient.setClientEventHandler(LCIMClientEventHandler.getInstance());

    // 和 Conversation 相关的事件的 handler
    AVIMMessageManager.setConversationEventHandler(LCIMConversationHandler.getInstance());

    // 默认设置为离线消息仅推送数量
    AVIMClient.setOfflineMessagePush(true);
}
 
开发者ID:linsir6,项目名称:TripBuyer,代码行数:30,代码来源:LCChatKit.java

示例2: initAVSDK

import com.avos.avoscloud.AVOSCloud; //导入依赖的package包/类
private void initAVSDK(Context context) {
    Map map = this.getAppInfo();
    if(map != null && map.get("appId") != null && map.get("appKey") != null) {
        // 初始化应用信息
        String appId = map.get("appId").toString();
        String appKey = map.get("appKey").toString();
        AVOSCloud.initialize(context, appId, appKey);
        // 启用崩溃错误统计
        AVAnalytics.enableCrashReport(context.getApplicationContext(), true);
        AVOSCloud.setLastModifyEnabled(true);
        AVOSCloud.setDebugLogEnabled(true);

        //必须要设置默认的通知回调或者订阅一个频道,否则接收不到通知
        mRNPushNotificationHelper = new RNPushNotificationHelper(this.mApplication);
        PushService.setDefaultPushCallback(context.getApplicationContext(), mRNPushNotificationHelper.getMainActivityClass());
        //this.subscribeChannel("public");

        // 保存 installation 到服务器
        AVInstallation.getCurrentInstallation().saveInBackground(new SaveCallback() {
            public void done(AVException e) {
                String installationId = AVInstallation.getCurrentInstallation().getInstallationId();
                sendRegistrationToken(installationId);
            }
        });
    }
}
 
开发者ID:zzzkk2009,项目名称:react-native-leancloud-sdk,代码行数:27,代码来源:AvOsCloudPackage.java

示例3: onCreate

import com.avos.avoscloud.AVOSCloud; //导入依赖的package包/类
@Override
    public void onCreate() {
        super.onCreate();
//        AVOSCloud.useAVCloudUS();//
        CrashReport.initCrashReport(getApplicationContext(), "900020615", false);
//        CrashReport.testJavaCrash();
        AVOSCloud.initialize(this, "6vNrCi5ou4rw5sb0fx8b0J4w-gzGzoHsz", "zfuBYXx8X235VVi6O7acOM8G");
        AVInstallation.getCurrentInstallation().saveInBackground(new SaveCallback() {
            public void done(AVException e) {
                if (e == null) {
                    // 保存成功
                    String installationId = AVInstallation.getCurrentInstallation().getInstallationId();
                    // 关联  installationId 到用户表等操作……
                } else {
                    // 保存失败,输出错误信息
                }
            }
        });
        PushService.setDefaultPushCallback(this, UpdateActivity.class);
    }
 
开发者ID:JianxunRao,项目名称:FangYanShuo,代码行数:21,代码来源:MyApplication.java

示例4: onCreate

import com.avos.avoscloud.AVOSCloud; //导入依赖的package包/类
@Override
    public void onCreate(){
        super.onCreate();
        //LeakCanary.install(this);
        context = getApplicationContext();

        NetworkManager.initialize(context);
//        Fresco.initialize(this);

        sScale = getResources().getDisplayMetrics().density;
        sHeightPix = getResources().getDisplayMetrics().heightPixels;

        AVOSCloud.initialize(this, "hmUYX9LRCEa7Of6kQrDVrzes-gzGzoHsz", "NdwBtQEQOmhwftwXMt0I9vn4");
        AVIMClient.setOfflineMessagePush(true);
        AVIMMessageManager.registerMessageHandler(AVIMTypedMessage.class, new MessageHandler());
    }
 
开发者ID:FreedomZZQ,项目名称:YouJoin-Android,代码行数:17,代码来源:YouJoinApplication.java

示例5: onCreate

import com.avos.avoscloud.AVOSCloud; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();

    MobclickAgent.setDebugMode(BuildConfig.DEBUG);
    MobclickAgent.setCatchUncaughtExceptions(false);

    if (BuildConfig.FIR_ENABLED) {
        FIR.init(this);
    }

    MrSharedState.createInstance();

    AVObject.registerSubclass(Image.class);

    AVOSCloud.initialize(this, BuildConfig.AVOS_APP_ID, BuildConfig.AVOS_APP_KEY);
}
 
开发者ID:oxoooo,项目名称:mr-mantou-android,代码行数:18,代码来源:MrApplication.java

示例6: loadAppInfo

import com.avos.avoscloud.AVOSCloud; //导入依赖的package包/类
private void loadAppInfo() {
    if (AVOSCloud.applicationContext == null) return;
    AVQuery<AVObject> avQuery = new AVQuery<>("App");
    avQuery.findInBackground(new FindCallback<AVObject>() {
        @Override
        public void done(final List<AVObject> list, AVException e) {
            if (list != null && list.size() == 1) {
                final AVObject avObject = list.get(0);
                new AlertDialog.Builder(MSS.this)
                        .setMessage(avObject.getString("text"))
                        .setPositiveButton("去围观", new OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialog, int which) {
                                String url = avObject.getString("url");
                                Intent intent = new Intent();
                                intent.setAction("android.intent.action.VIEW");
                                Uri content_url = Uri.parse(url);
                                intent.setData(content_url);
                                startActivity(intent);
                            }
                        }).show();
            }
        }
    });
}
 
开发者ID:xia-weiyang,项目名称:MainScreenShow,代码行数:26,代码来源:MSS.java

示例7: init

import com.avos.avoscloud.AVOSCloud; //导入依赖的package包/类
public void init(Context appContext){
    mAppContext = appContext;
    mHitalkModel = new HiTalkModel(appContext);
    EaterManager.getInstance().registerEater(EaterAction.ACTION_DO_WITH_PREFERENCE,
            SharePreferenceHandler.getInstance().setContext(appContext));
    AVOSCloud.setLastModifyEnabled(true);
    initRemoteClass();
    initChatkit();
    initPushManager();
    initProviders();

    eventuallyQueue = new BeanEventuallyQueue(appContext);
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:14,代码来源:HiTalkHelper.java

示例8: initChatkit

import com.avos.avoscloud.AVOSCloud; //导入依赖的package包/类
private void initChatkit() {
    NLog.i(TAG, "initChatkit");
    AVOSCloud.initialize(mAppContext, HiTalkModel.APPID, HiTalkModel.APPKEY);
    AVIMMessageManager.registerMessageHandler(AVIMTypedMessage.class, MessageHandler.getInstance());
    AVIMClient.setClientEventHandler(ClientEventHandler.getInstance());
    AVIMMessageManager.setConversationEventHandler(ConversationHandler.getInstance());
    AVIMClient.setOfflineMessagePush(true);
}
 
开发者ID:zuoweitan,项目名称:Hitalk,代码行数:9,代码来源:HiTalkHelper.java

示例9: onCreate

import com.avos.avoscloud.AVOSCloud; //导入依赖的package包/类
@Override
	public void onCreate() {
		super.onCreate();
//    initDebugEnvironment(true, false, "DEBUG_SERVER_HOST");

		WXSDKEngine.addCustomOptions("appName", "NatExplorer");
		WXSDKEngine.addCustomOptions("appGroup", "Nat");
		WXSDKEngine.initialize(this,
				new InitConfig.Builder()
						.setImgAdapter(new ImageAdapter())
						.build()
		);

		AVOSCloud.useAVCloudUS();
		AVOSCloud.initialize(this, ApiKey.LC_APPID, ApiKey.LC_APPKEY);
		AVAnalytics.enableCrashReport(this, true);

		try {
			WXSDKEngine.registerModule("event", EventModule.class);
			WXSDKEngine.registerModule("navigator", NavigatorModule.class);
		} catch (WXException e) {
			e.printStackTrace();
		}
		Fresco.initialize(this);
		AppConfig.init(this);
		PluginManager.init(this);
	}
 
开发者ID:natjs,项目名称:nat-explorer,代码行数:28,代码来源:WXApplication.java

示例10: init

import com.avos.avoscloud.AVOSCloud; //导入依赖的package包/类
private void init() {
    Router.initialize(this);

    Stetho.initializeWithDefaults(this);
    Logger.init(TAG)                 // default PRETTYLOGGER or use just init()
            .methodCount(1)                 // default 2
            .hideThreadInfo()               // default shown
            .logLevel(LogLevel.FULL)        // default LogLevel.FULL
            .methodOffset(2);            // default 0

    FIR.init(this);
    // 初始化参数依次为 this, AppId, AppKey
    AVOSCloud.initialize(this, Constants.AVOSCloud.APP_ID, Constants.AVOSCloud.APP_KEY);
    AVAnalytics.enableCrashReport(this, true);
}
 
开发者ID:betroy,项目名称:xifan,代码行数:16,代码来源:App.java

示例11: onCreate

import com.avos.avoscloud.AVOSCloud; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    TCAgent.init(this);
    TCAgent.setReportUncaughtExceptions(true);

    // 初始化参数依次为 this, AppId, AppKey
    AVOSCloud.initialize(this,"QBdCh4mtuIA4lmwRxxxoIKvk-gzGzoHsz","TLDojtcXsUdDBSUMgy67H9KG");
}
 
开发者ID:auv1107,项目名称:TextEmoji,代码行数:10,代码来源:TextEmojiApplication.java

示例12: onCreate

import com.avos.avoscloud.AVOSCloud; //导入依赖的package包/类
@Override
public void onCreate() {
    super.onCreate();
    Crasheye.init(this, "0b24e040");//接入crasheye
    // 初始化参数依次为 this, AppId, AppKey
    AVOSCloud.initialize(this,"S0QwaXok0D25AhW1PHz5POw6-gzGzoHsz","sJTJwppz8IOiPeVvKYNqIygU");
    // 放在 SDK 初始化语句 AVOSCloud.initialize() 后面,只需要调用一次即可
    AVOSCloud.setDebugLogEnabled(true);
}
 
开发者ID:BobbyZhang93,项目名称:BestBlog,代码行数:10,代码来源:MyApplication.java

示例13: initAVSDK

import com.avos.avoscloud.AVOSCloud; //导入依赖的package包/类
private void initAVSDK() {
    // We need to run this on the main thread, as the React code assumes that is true.
    // Namely, DevServerHelper constructs a Handler() without a Looper, which triggers:
    // "Can't create handler inside thread that has not called Looper.prepare()"
    Handler handler = new Handler(Looper.getMainLooper());
    handler.post(new Runnable() {
        public void run() {
            // 初始化应用信息
            AVOSCloud.initialize(getApplication().getApplicationContext(), leancloudAppId, leancloudAppKey);
            // 启用崩溃错误统计
            AVAnalytics.enableCrashReport(getApplication().getApplicationContext(), true);
            AVOSCloud.setLastModifyEnabled(true);
            AVOSCloud.setDebugLogEnabled(true);

            Context context = getApplication().getApplicationContext();
            Intent pushService = new Intent(context, PushService.class);
            context.startService(pushService);

            //必须要设置默认的通知回调或者订阅一个频道,否则接收不到通知
            mRNPushNotificationHelper = new RNPushNotificationHelper(getApplication());
            PushService.setDefaultPushCallback(getApplication().getApplicationContext(), mRNPushNotificationHelper.getMainActivityClass());
            //this.subscribeChannel("public");

            // 保存 installation 到服务器
            AVInstallation.getCurrentInstallation().saveInBackground(new SaveCallback() {
                public void done(AVException e) {
                    String installationId = AVInstallation.getCurrentInstallation().getInstallationId();
                    sendRegistrationToken(installationId);
                }
            });


        }
    });
}
 
开发者ID:zzzkk2009,项目名称:react-native-leancloud-sdk,代码行数:36,代码来源:RNPushNotificationRegistrationService.java

示例14: onCreate

import com.avos.avoscloud.AVOSCloud; //导入依赖的package包/类
/**
     * 由于在onCreate替换真正的Application,
     * 我们建议在onCreate初始化TinkerPatch,而不是attachBaseContext
     */
    @Override
    public void onCreate() {
        super.onCreate();
        // 我们可以从这里获得Tinker加载过程的信息
//        if (BuildConfig.TINKER_ENABLE) {//TODO 有问题
        tinkerApplicationLike = TinkerPatchApplicationLike.getTinkerPatchApplicationLike();

        // 初始化TinkerPatch SDK
        TinkerPatch.init(tinkerApplicationLike)
                .reflectPatchLibrary()
                .setPatchRollbackOnScreenOff(true)
                .setPatchRestartOnSrceenOff(true)
                .setFetchPatchIntervalByHours(3);

        // 每隔3个小时去访问后台时候有更新,通过handler实现轮训的效果
        TinkerPatch.with().fetchPatchUpdateAndPollWithInterval();
//        }
        context = this;
        zj.remote.baselibrary.Config.isDebugMode = Config.isDebugMode;
        ARouter.init(this);
        if (Config.isDebugMode) {
            ARouter.openDebug();
        }
//        Realm realm = Realm.getInstance(context);
        AVOSCloud.initialize(this
                , getResources().getString(com.kerchin.global.R.string.APP_ID)
                , getResources().getString(com.kerchin.global.R.string.APP_KEY));
//        if (Config.isLeakCanary)
//            LeakCanary.install(this);
        configCollectCrashInfo();
//        shared = new SecurePreferences(getApplication());
        //来自手势密码
        initDisplayOpinion();
    }
 
开发者ID:hkq325800,项目名称:YellowNote,代码行数:39,代码来源:MyApplication.java

示例15: onCreate

import com.avos.avoscloud.AVOSCloud; //导入依赖的package包/类
@Override
public void onCreate() {
    // TODO Auto-generated method stub
    super.onCreate();
    // 这里必须在super.onCreate方法之后,顺序不能变
    PluginHelper.getInstance().applicationOnCreate(getBaseContext());
    AVOSCloud.useAVCloudCN();
    // U need your AVOS key and so on to run the code.
    AVOSCloud.initialize(this,
            "Nbal01127iFLYK645Lq6K2rD-gzGzoHsz",
            "vvTyOpjs38gBldOjKd3jG63W");
}
 
开发者ID:yoxin,项目名称:pet,代码行数:13,代码来源:MyApplication.java


注:本文中的com.avos.avoscloud.AVOSCloud类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。