本文整理汇总了Java中com.getpebble.android.kit.util.PebbleDictionary.getUnsignedIntegerAsLong方法的典型用法代码示例。如果您正苦于以下问题:Java PebbleDictionary.getUnsignedIntegerAsLong方法的具体用法?Java PebbleDictionary.getUnsignedIntegerAsLong怎么用?Java PebbleDictionary.getUnsignedIntegerAsLong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.getpebble.android.kit.util.PebbleDictionary
的用法示例。
在下文中一共展示了PebbleDictionary.getUnsignedIntegerAsLong方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: receiveData
import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
@Override
public void receiveData(int transactionId, PebbleDictionary data) {
Log.d(TAG, "receiveData: transactionId is " + String.valueOf(transactionId));
lastTransactionId = transactionId;
Log.d(TAG, "Received Query. data: " + data.size() + ".");
if (data.size() > 0) {
pebble_sync_value = data.getUnsignedIntegerAsLong(SYNC_KEY);
pebble_platform = data.getUnsignedIntegerAsLong(PLATFORM_KEY);
pebble_app_version = data.getString(VERSION_KEY);
Log.d(TAG, "receiveData: pebble_sync_value=" + pebble_sync_value + ", pebble_platform=" + pebble_platform + ", pebble_app_version=" + pebble_app_version);
} else {
Log.d(TAG, "receiveData: pebble_app_version not known");
}
PebbleKit.sendAckToPebble(context, transactionId);
transactionFailed = false;
transactionOk = false;
messageInTransit = false;
sendStep = 5;
sendData();
}
示例2: evaluateDataFromPebble
import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
private void evaluateDataFromPebble(PebbleDictionary data) {
if (data.size() > 0) {
pebble_sync_value = data.getUnsignedIntegerAsLong(SYNC_KEY);
pebble_platform = data.getUnsignedIntegerAsLong(PLATFORM_KEY);
pebble_app_version = data.getString(VERSION_KEY);
Log.d(TAG, "receiveData: pebble_sync_value=" + pebble_sync_value + ", pebble_platform=" + pebble_platform + ", pebble_app_version=" + pebble_app_version);
switch ((int)pebble_platform) {
case 0:
if (PebbleUtil.pebbleDisplayType != PebbleDisplayType.TrendClassic) {
PebbleUtil.pebbleDisplayType = PebbleDisplayType.TrendClassic;
//JoH.static_toast_short("Switching to Pebble Classic Trend");
Log.d(TAG,"Changing to Classic Trend due to platform id");
}
break;
}
} else {
Log.d(TAG, "receiveData: pebble_app_version not known");
}
}
示例3: gotMessageConfigChange
import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
private void gotMessageConfigChange(PebbleDictionary message)
{
SharedPreferences.Editor editor = getService().getGlobalSettings().edit();
int id = message.getUnsignedIntegerAsLong(2).intValue();
switch (id)
{
case 0: //Notifications disabled
boolean value = message.getUnsignedIntegerAsLong(3) != 0;
editor.putBoolean(PebbleNotificationCenter.NOTIFICATIONS_DISABLED, value);
break;
case 1: //Vibration disabled
value = message.getUnsignedIntegerAsLong(3) != 0;
editor.putBoolean(PebbleNotificationCenter.VIBRATION_DISABLED, value);
break;
case 2: //Clear history
NCTalkerService.fromPebbleTalkerService(getService()).getHistoryDatabase().clearDatabase();
break;
}
editor.apply();
}
示例4: onStartCommand
import com.getpebble.android.kit.util.PebbleDictionary; //导入方法依赖的package包/类
@Override
public int onStartCommand( final Intent intent, final int flags, final int startId )
{
if( intent != null )
{
if( ACTION_STOP_RINGING.equals( intent.getAction() ) )
{
silencePhone( this );
}
else
{
if( Purchase.isActive( this ) )
{
SharedPreferences settings = PreferenceManager.getDefaultSharedPreferences( this );
final boolean silentMode = settings.getBoolean( Preferences.KEY_SILENT_MODE, false );
final int transactionId = intent.getIntExtra( Constants.TRANSACTION_ID, -1 );
final String jsonData = intent.getStringExtra( Constants.MSG_DATA );
if( jsonData != null )
{
try
{
final long cmd;
final PebbleDictionary data = PebbleDictionary.fromJson( jsonData );
if( data != null )
{
cmd = data.getUnsignedIntegerAsLong( CMD_KEY );
}
else
{
cmd = -1;
}
if( cmd == CMD_START )
{
Log.w( TAG, "Ring Command Received!" );
setMaxVolume( this );
ringPhone( this, silentMode );
}
else if( cmd == CMD_STOP )
{
Log.w( TAG, "Silence Command Received!" );
silencePhone( this );
}
else
{
Log.w( TAG, "Bad command received from pebble app: " + cmd );
}
}
catch( final JSONException e )
{
Log.w( TAG, "failed retrieved -> dict" + e );
}
}
else
{
Log.w( TAG, "No data from Pebble" );
}
}
else
{
postExpiredNotification();
}
}
}
return START_NOT_STICKY;
}