本文整理汇总了Java中com.getpebble.android.kit.PebbleKit.closeAppOnPebble方法的典型用法代码示例。如果您正苦于以下问题:Java PebbleKit.closeAppOnPebble方法的具体用法?Java PebbleKit.closeAppOnPebble怎么用?Java PebbleKit.closeAppOnPebble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.getpebble.android.kit.PebbleKit
的用法示例。
在下文中一共展示了PebbleKit.closeAppOnPebble方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startWatchApp
import com.getpebble.android.kit.PebbleKit; //导入方法依赖的package包/类
/**
* Attempt to start the pebble_sd watch app on the pebble watch.
*/
public void startWatchApp() {
Log.v(TAG, "startWatchApp() - closing app first");
mUtil.writeToSysLogFile("SdDataSourcePebble.startWatchApp() - closing app first");
// first close the watch app if it is running.
PebbleKit.closeAppOnPebble(mContext, SD_UUID);
Log.v(TAG, "startWatchApp() - starting watch app after 5 seconds delay...");
// Wait 5 seconds then start the app.
Timer appStartTimer = new Timer();
appStartTimer.schedule(new TimerTask() {
@Override
public void run() {
Log.v(TAG, "startWatchApp() - starting watch app...");
mUtil.writeToSysLogFile("SdDataSourcePebble.startWatchApp() - starting watch app");
PebbleKit.startAppOnPebble(mContext, SD_UUID);
}
}, 5000);
}
示例2: onDestroy
import com.getpebble.android.kit.PebbleKit; //导入方法依赖的package包/类
/**
* Closes the text file of words.
*/
@Override
protected void onDestroy()
{
super.onDestroy();
try
{
in.close();
}
catch ( IOException e )
{
e.printStackTrace();
}
if ( null != mReceiver )
{
unregisterReceiver( mReceiver );
}
PebbleKit.closeAppOnPebble( getApplicationContext(), MSG_UUID );
}
示例3: closeApp
import com.getpebble.android.kit.PebbleKit; //导入方法依赖的package包/类
public void closeApp()
{
Timber.d("CloseApp %s", currentRunningApp);
NotificationSendingModule notificationSendingModule = NotificationSendingModule.get(getService());
if (notificationSendingModule.isAnyNotificationWaiting())
return;
if (getService().getGlobalSettings().getBoolean(PebbleNotificationCenter.CLOSE_TO_LAST_APP, false) && canCloseToApp(currentRunningApp) && closeTries < 2)
PebbleKit.startAppOnPebble(getService(), currentRunningApp);
else
PebbleKit.closeAppOnPebble(getService(), PebbleNotificationCenter.WATCHAPP_UUID);
SharedPreferences.Editor editor = getService().getGlobalSettings().edit();
editor.putLong("lastClose", System.currentTimeMillis());
editor.apply();
closeTries++;
}
示例4: destory
import com.getpebble.android.kit.PebbleKit; //导入方法依赖的package包/类
/**
* Pebble側のアプリを終了する.
*/
public void destory() {
getContext().unregisterReceiver(mHandler);
getContext().unregisterReceiver(mConnectHandler);
getContext().unregisterReceiver(mDisconnectHandler);
getContext().unregisterReceiver(mAckHandler);
getContext().unregisterReceiver(mNackHandler);
PebbleKit.closeAppOnPebble(getContext(), MY_UUID);
mExecutor.shutdown();
}
示例5: onStartCommand
import com.getpebble.android.kit.PebbleKit; //导入方法依赖的package包/类
@Override
public int onStartCommand(Intent intent, int flags, int startid) {
if(intent != null) {
final String action = intent.getAction();
lastReceivedAction = action;
switch (action) {
case GCSEvent.ACTION_VEHICLE_CONNECTION:
PebbleKit.startAppOnPebble(applicationContext, DP_UUID);
connParams = intent.getParcelableExtra("extra_connection_parameter");
connect3DRServices();
break;
case GCSEvent.ACTION_VEHICLE_DISCONNECTION:
PebbleKit.closeAppOnPebble(getApplicationContext(), DP_UUID);
stopSelf();
break;
case ACTION_CHECK_CONNECTION_STATE:
if (!drone.isConnected()) {
if(controlTower.isTowerConnected()){
checkConnectedApps();
}
else{
connect3DRServices();
}
}
break;
}
}
//Start a watchdog to automatically stop the service when it's no longer needed.
handler.removeCallbacks(destroyWatchdog);
handler.postDelayed(destroyWatchdog, WATCHDOG_TIMEOUT);
//Using redeliver intent because we want the intent to be resend if the service is killed.
return START_REDELIVER_INTENT;
}
示例6: noNetworkFound
import com.getpebble.android.kit.PebbleKit; //导入方法依赖的package包/类
public void noNetworkFound () {
if (PebbleKit.areAppMessagesSupported(getApplicationContext())) {
PebbleDictionary networkFail = new PebbleDictionary();
networkFail.addUint8(0, (byte) 0);
networkFail.addUint8(1, (byte) 0); // Filler value
networkFail.addString(2, "LIFX Network not found.");
Log.i("Dictionary", networkFail.toJsonString());
PebbleKit.sendDataToPebble(getApplicationContext(), PEBBLE_APP_UUID, networkFail);
Log.i("", "Data sent.");
}
PebbleKit.closeAppOnPebble(getApplicationContext(), PEBBLE_APP_UUID);
}
示例7: killApp
import com.getpebble.android.kit.PebbleKit; //导入方法依赖的package包/类
@Kroll.method
public void killApp(HashMap args)
{
Log.d(LCAT, "killApp");
if(!checkWatchConnected())
{
Log.w(LCAT, "killApp: No watch connected");
return;
}
final KrollFunction successCallback = (KrollFunction)args.get("success");
final KrollFunction errorCallback = (KrollFunction)args.get("error");
try
{
PebbleKit.closeAppOnPebble(getApplicationContext(), uuid);
Log.d(LCAT, "killApp: Success");
if(successCallback != null)
{
HashMap event = new HashMap();
event.put("message", "Successfully killed app");
successCallback.call(getKrollObject(), event);
}
} catch(IllegalArgumentException e) {
Log.e(LCAT, "killApp: Error");
if(errorCallback != null)
{
errorCallback.call(getKrollObject(), new Object[] {});
}
return;
}
}
示例8: closeApp
import com.getpebble.android.kit.PebbleKit; //导入方法依赖的package包/类
public void closeApp()
{
Timber.d("CloseApp %s", currentRunningApp);
if (getService().getGlobalSettings().getBoolean("closeToLastApp", false) && canCloseToApp(currentRunningApp) && closeTries < 2)
PebbleKit.startAppOnPebble(getService(), currentRunningApp);
else
PebbleKit.closeAppOnPebble(getService(), PebbleDialerApplication.WATCHAPP_UUID);
closeTries++;
}
示例9: sendCloseAppOnPebble
import com.getpebble.android.kit.PebbleKit; //导入方法依赖的package包/类
/**
* Pebbleにアプリ終了イベントを送信する.
*/
public void sendCloseAppOnPebble() {
PebbleKit.closeAppOnPebble(getContext(), MY_UUID);
}
示例10: onDroneEvent
import com.getpebble.android.kit.PebbleKit; //导入方法依赖的package包/类
@Override
public void onDroneEvent(String event, Bundle bundle) {
try {
final String action = new Intent(event).getAction();
switch (action) {
case AttributeEvent.STATE_DISCONNECTED:
PebbleKit.closeAppOnPebble(applicationContext, DP_UUID);
stopSelf();
break;
case AttributeEvent.STATE_CONNECTED:
case AttributeEvent.HEARTBEAT_FIRST:
PebbleKit.startAppOnPebble(applicationContext, DP_UUID);
Thread.sleep(250);
sendDataToWatchNow(drone);
break;
//Telem gets slow updates
case AttributeEvent.BATTERY_UPDATED:
case AttributeEvent.ATTITUDE_UPDATED:
sendDataToWatchIfTimeHasElapsed(drone);
break;
//Mode changes get fast updates
case AttributeEvent.STATE_VEHICLE_MODE:
case AttributeEvent.FOLLOW_START:
case AttributeEvent.STATE_ARMING:
case AttributeEvent.STATE_UPDATED:
sendDataToWatchNow(drone);
break;
//Follow type update gets fast update
case AttributeEvent.FOLLOW_UPDATE:
final FollowState followState = drone.getAttribute(AttributeType.FOLLOW_STATE);
if(followState != null){
final FollowType followType = followState.getMode();
if(!previousFollowType.equals(followType)){
previousFollowType = followType;
sendDataToWatchNow(drone);
}
}
}
}catch(Exception e){
//TODO figure out what was messing up here
}
}
示例11: stopWatchApp
import com.getpebble.android.kit.PebbleKit; //导入方法依赖的package包/类
/**
* stop the pebble_sd watch app on the pebble watch.
*/
public void stopWatchApp() {
Log.v(TAG, "stopWatchApp()");
mUtil.writeToSysLogFile("SdDataSourcePebble.stopWatchApp()");
PebbleKit.closeAppOnPebble(mContext, SD_UUID);
}
示例12: stopWatchApp
import com.getpebble.android.kit.PebbleKit; //导入方法依赖的package包/类
public void stopWatchApp() {
PebbleKit.closeAppOnPebble(getApplicationContext(), uuid);
}
示例13: hideWatchFace
import com.getpebble.android.kit.PebbleKit; //导入方法依赖的package包/类
@Override
public void hideWatchFace() {
PebbleKit.closeAppOnPebble(_applicationContext,Constants.WATCH_UUID);
}