本文整理汇总了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();
}
示例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;
}
}
示例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();
}
示例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;
}
示例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;
}
示例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();
}
示例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();
}
示例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();
}
示例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);
}
示例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();
}
}