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


Java OneSheeldSdk类代码示例

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


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

示例1: onCreate

import com.integreight.onesheeld.sdk.OneSheeldSdk; //导入依赖的package包/类
@Override
public void onCreate() {
    OneSheeldSdk.init(this);
    context = getApplicationContext();
    setAppPreferences(getSharedPreferences(APP_PREF_NAME, MODE_PRIVATE));
    appFont = Typeface.createFromAsset(getAssets(), "Roboto-Light.ttf");
    parseSocialKeys();
    initTaskerPins();
    isDebuggable = (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));
    if (isDebuggable() && !FirebaseApp.getApps(this).isEmpty())
        FirebaseMessaging.getInstance().subscribeToTopic("dev");
    OneSheeldSdk.setDebugging(isDebuggable);
    connectionTime = 0;
    AppShields.getInstance().init(getRememberedShields());
    initCrashlyticsAndUncaughtThreadHandler();
    super.onCreate();
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:18,代码来源:OneSheeldApplication.java

示例2: startService

import com.integreight.onesheeld.sdk.OneSheeldSdk; //导入依赖的package包/类
private void startService(String address, String name) {
    if (!isConnecting) {
        isConnecting = true;
        if (OneSheeldSdk.getManager().isScanning()){
            isScanningFinishedManually = true;
            OneSheeldSdk.getManager().cancelScanning();
        }

        // Get the device MAC address, which is the last 17 chars in
        // the
        // View
        showProgress();
        changeSlogan(
                activity.getResources().getString(R.string.connectivity_popup_connecting) + "......",
                COLOR.GREEN);
        findViewById(R.id.skip_scan).setVisibility(View.INVISIBLE);
        OneSheeldSdk.getManager().connect(new OneSheeldDevice(address, name));
        isConnecting = true;
    }
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:21,代码来源:ArduinoConnectivityPopup.java

示例3: onCreate

import com.integreight.onesheeld.sdk.OneSheeldSdk; //导入依赖的package包/类
@Override
public void onCreate() {
    OneSheeldSdk.init(this);
    context = getApplicationContext();
    setAppPreferences(getSharedPreferences(APP_PREF_NAME, MODE_PRIVATE));
    appFont = Typeface.createFromAsset(getAssets(), "Roboto-Light.ttf");
    parseSocialKeys();
    initTaskerPins();
    isDebuggable = (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));
    if (isDebuggable() && !FirebaseApp.getApps(this).isEmpty())
        FirebaseMessaging.getInstance().subscribeToTopic("dev");
    OneSheeldSdk.setDebugging(isDebuggable);
    connectionTime = 0;
    AppShields.getInstance().init(getRememberedShields());
    initCrashlyticsAndUncaughtThreadHandler();
    detectIfLocatedInTheUs();
    super.onCreate();
}
 
开发者ID:Integreight,项目名称:1Sheeld-Android-App,代码行数:19,代码来源:OneSheeldApplication.java

示例4: destroyIt

import com.integreight.onesheeld.sdk.OneSheeldSdk; //导入依赖的package包/类
private void destroyIt() {
    if (!isConfigChanged) {
        getThisApplication().getTracker().send(
                new HitBuilders.EventBuilder().setCategory("App lifecycle")
                        .setAction("Finished the app manually").build());
        ArduinoConnectivityPopup.isOpened = false;
        stopService();
        stopLooperThread();
        moveTaskToBack(true);
        OneSheeldSdk.getManager().disconnectAll();
        // // unExpeted
        if (!isBackPressed) {
            Enumeration<String> enumKey = ((OneSheeldApplication)
                    getApplication()).getRunningShields().keys();
            while (enumKey.hasMoreElements()) {
                String key = enumKey.nextElement();
                ((OneSheeldApplication) getApplication())
                        .getRunningShields().get(key).resetThis();
                ((OneSheeldApplication) getApplication())
                        .getRunningShields().remove(key);
            }
            Intent in = new Intent(getIntent());
            PendingIntent intent = PendingIntent.getActivity(
                    getBaseContext(), 0, in, getIntent().getFlags());
            AlarmManager mgr = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                mgr.setExact(AlarmManager.RTC, System.currentTimeMillis() + 100,
                        intent);
            } else {
                mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 100,
                        intent);
            }
            killAllProcesses();
        } else
            killAllProcesses();
    }
    isConfigChanged = false;
    isBackPressed = false;
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:40,代码来源:MainActivity.java

示例5: onStartCommand

import com.integreight.onesheeld.sdk.OneSheeldSdk; //导入依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    // TODO Auto-generated method stub
    if (intent.getExtras() != null) {
        deviceName = intent.getExtras().getString(
                ArduinoConnectivityPopup.EXTRA_DEVICE_NAME);
        // Attempt to connect to the device
        OneSheeldSdk.getManager().addConnectionCallback(connectionCallback);
        OneSheeldSdk.getManager().addErrorCallback(errorCallback);
    }
    showNotification();
    WakeLocker.acquire(this);
    return START_NOT_STICKY;
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:15,代码来源:OneSheeldService.java

示例6: onDestroy

import com.integreight.onesheeld.sdk.OneSheeldSdk; //导入依赖的package包/类
@Override
public void onDestroy() {
    // TODO Auto-generated method stub
   OneSheeldSdk.getManager().disconnectAll();
    hideNotifcation();
    isBound = false;
    WakeLocker.release();
    super.onDestroy();
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:10,代码来源:OneSheeldService.java

示例7: onBackPressed

import com.integreight.onesheeld.sdk.OneSheeldSdk; //导入依赖的package包/类
@Override
public void onBackPressed() {
    if (OneSheeldSdk.getManager().isScanning()) {
        isScanningFinishedManually = true;
        OneSheeldSdk.getManager().cancelScanning();
        setScanButtonReady();
    } else if (OneSheeldSdk.getManager().isConnecting()) {
        isConnecting = false;
        OneSheeldSdk.getManager().cancelConnecting();
        setDevicesListReady();
        changeSlogan(
                activity.getResources()
                        .getString(R.string.connectivity_popup_select_your_device), COLOR.YELLOW);
        findViewById(R.id.skip_scan).setVisibility(View.VISIBLE);
    } else if (scanOrTryAgain.getVisibility() != View.VISIBLE
            || !scanOrTryAgain
            .getText()
            .toString()
            .equalsIgnoreCase(
                    activity.getResources()
                            .getString(R.string.connectivity_popup_scan_button)))
        setScanButtonReady();
    else {
        ((MainActivity) activity).finishManually();
        dismiss();
        cancel();
    }
    backPressed = true;
    // super.onBackPressed();
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:31,代码来源:ArduinoConnectivityPopup.java

示例8: doDiscovery

import com.integreight.onesheeld.sdk.OneSheeldSdk; //导入依赖的package包/类
/**
 * Start device discover with the BluetoothAdapter
 */
private synchronized void doDiscovery() {
    // If we're already discovering, stop it

    if (OneSheeldSdk.getManager().isScanning()) {
        isScanningFinishedManually = true;
        OneSheeldSdk.getManager().cancelScanning();
    }

    // Request discover from BluetoothAdapter
    OneSheeldSdk.getManager().scan();
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:15,代码来源:ArduinoConnectivityPopup.java

示例9: initOneSheeldSdk

import com.integreight.onesheeld.sdk.OneSheeldSdk; //导入依赖的package包/类
private void initOneSheeldSdk() {
    OneSheeldSdk.setDebugging(true);
    OneSheeldSdk.init(this);
    oneSheeldManager = OneSheeldSdk.getManager();
    oneSheeldManager.setConnectionRetryCount(1);
    oneSheeldManager.setAutomaticConnectingRetriesForClassicConnections(true);
    oneSheeldManager.addScanningCallback(scanningCallback);
    oneSheeldManager.addConnectionCallback(connectionCallback);
    oneSheeldManager.addErrorCallback(errorCallback);
}
 
开发者ID:Integreight,项目名称:1Sheeld-Android-SDK,代码行数:11,代码来源:MainActivity.java

示例10: initCrashlyticsAndUncaughtThreadHandler

import com.integreight.onesheeld.sdk.OneSheeldSdk; //导入依赖的package包/类
private void initCrashlyticsAndUncaughtThreadHandler() {
    Thread.UncaughtExceptionHandler myHandler = new Thread.UncaughtExceptionHandler() {

        @Override
        public void uncaughtException(Thread arg0, final Throwable arg1) {
            arg1.printStackTrace();
            ArduinoConnectivityPopup.isOpened = false;
            MainActivity.thisInstance.moveTaskToBack(true);

            Enumeration<String> enumKey = getRunningShields().keys();
            while (enumKey.hasMoreElements()) {
                String key = enumKey.nextElement();
                getRunningShields().get(key).resetThis();
                getRunningShields().remove(key);
            }
            OneSheeldSdk.getManager().disconnectAll();
            if (MainActivity.thisInstance != null)
                MainActivity.thisInstance.stopService();
            Intent in = MainActivity.thisInstance != null ? new Intent(MainActivity.thisInstance.getIntent()) : new Intent();
            PendingIntent intent = PendingIntent
                    .getActivity(getBaseContext(), 0, in,
                            MainActivity.thisInstance != null ? MainActivity.thisInstance.getIntent().getFlags() : 0);

            AlarmManager mgr = (AlarmManager) getSystemService(Context.ALARM_SERVICE);
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                mgr.setExact(AlarmManager.RTC, System.currentTimeMillis() + 1000,
                        intent);
            } else {
                mgr.set(AlarmManager.RTC, System.currentTimeMillis() + 1000,
                        intent);
            }
            setTutShownTimes(
                    getTutShownTimes() + 1);
            android.os.Process.killProcess(android.os.Process.myPid());
        }
    };
    Thread.setDefaultUncaughtExceptionHandler(myHandler);
    try {
        Fabric.with(this, new Crashlytics());
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:Dnet3,项目名称:CustomAndroidOneSheeld,代码行数:44,代码来源:OneSheeldApplication.java


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