本文整理汇总了Java中locus.api.android.utils.exceptions.RequiredVersionMissingException类的典型用法代码示例。如果您正苦于以下问题:Java RequiredVersionMissingException类的具体用法?Java RequiredVersionMissingException怎么用?Java RequiredVersionMissingException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
RequiredVersionMissingException类属于locus.api.android.utils.exceptions包,在下文中一共展示了RequiredVersionMissingException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: callSendMorePointsGeocacheFileMethod
import locus.api.android.utils.exceptions.RequiredVersionMissingException; //导入依赖的package包/类
/**
* Send more geocaches with method, that store byte[] data in raw file and send locus link to this file.
* This method is useful in case of bigger number of caches that already has some troubles with
* method over intent.
* @param ctx current context
*/
public static void callSendMorePointsGeocacheFileMethod(Context ctx) throws RequiredVersionMissingException {
// get filepath
File externalDir = ctx.getExternalCacheDir();
if (externalDir == null || !(externalDir.exists())) {
Logger.logW(TAG, "problem with obtain of External dir");
return;
}
// prepare data
PackWaypoints pw = new PackWaypoints("test07");
for (int i = 0; i < 1000; i++) {
pw.addWaypoint(generateGeocache(i));
}
ArrayList<PackWaypoints> data = new ArrayList<>();
data.add(pw);
// send data
boolean send = ActionDisplayPoints.sendPacksFile(ctx, data,
new File(externalDir, "testFile.locus").getAbsolutePath(), ExtraAction.CENTER);
Logger.logD(TAG, "callSendMorePointsGeocacheFileMethod(), " +
"send:" + send);
}
示例2: loadHandShake
import locus.api.android.utils.exceptions.RequiredVersionMissingException; //导入依赖的package包/类
/**
* Load basic data from current Locus application.
*/
private HandShakeValue loadHandShake(Context ctx) {
LocusInfo locusInfo = null;
try {
// check if object exists
if (lv != null) {
// handle info
locusInfo = ActionTools.getLocusInfo(ctx, lv);
}
} catch (RequiredVersionMissingException e) {
Logger.logE(TAG, "loadHandShake", e);
// clear data
locusInfo = null;
}
// prepare container with data and send it
HandShakeValue value = lv == null ?
new HandShakeValue() :
new HandShakeValue(lv.getVersionCode(),
locusInfo != null && locusInfo.isRunning(),
locusInfo != null && locusInfo.isPeriodicUpdatesEnabled());
return value;
}
示例3: delete
import locus.api.android.utils.exceptions.RequiredVersionMissingException; //导入依赖的package包/类
/**
* Delete field note specified by it's ID
* @param ctx existing context
* @param lv active Locus version
* @param fieldNoteId ID of field note to delete
* @return <code>true</code> if deleted successfully, otherwise <code>false</code>
*/
public static boolean delete(Context ctx, LocusUtils.LocusVersion lv, long fieldNoteId)
throws RequiredVersionMissingException {
// get parameters for query
Uri cpUri = getUriFieldNoteTable(lv);
// execute request
int res = ctx.getContentResolver().delete(cpUri,
ColFieldNote.ID + "=?",
new String[] {Long.toString(fieldNoteId)}
);
// delete images
deleteImages(ctx, lv, fieldNoteId);
// return result
return res == 1;
}
示例4: insert
import locus.api.android.utils.exceptions.RequiredVersionMissingException; //导入依赖的package包/类
/**
* Simple insert of one field note
* @param ctx existing context
* @param lv active Locus version
* @param gcFn field note that should be inserted.
* @return <code>true</code> if insert was successful, otherwise false
*/
public static boolean insert(Context ctx, LocusUtils.LocusVersion lv,
FieldNote gcFn) throws RequiredVersionMissingException {
// get parameters for query
Uri cpUri = getUriFieldNoteTable(lv);
// create data container
ContentValues cv = createContentValues(gcFn);
// execute request
Uri newRow = ctx.getContentResolver().insert(cpUri, cv);
if (newRow != null) {
// set new ID to field note
gcFn.setId(Utils.parseLong(newRow.getLastPathSegment()));
// insert also images
storeAllImages(ctx, lv, gcFn);
// return result
return true;
}
return false;
}
示例5: storeAllImages
import locus.api.android.utils.exceptions.RequiredVersionMissingException; //导入依赖的package包/类
/**************************************************/
private static void storeAllImages(Context ctx, LocusUtils.LocusVersion lv, FieldNote fn)
throws RequiredVersionMissingException {
Iterator<FieldNoteImage> images = fn.getImages();
while (images.hasNext()) {
FieldNoteImage img = images.next();
img.setFieldNoteId(fn.getId());
// update or insert image
if (img.getId() >= 0) {
updateImage(ctx, lv, img);
} else {
insertImage(ctx, lv, img);
}
}
}
示例6: getImage
import locus.api.android.utils.exceptions.RequiredVersionMissingException; //导入依赖的package包/类
public static FieldNoteImage getImage(Context ctx, LocusUtils.LocusVersion lv, long imgId)
throws RequiredVersionMissingException {
// get parameters for query
Uri cpUri = getUriFieldNoteImagesTable(lv);
cpUri = ContentUris.withAppendedId(cpUri, imgId);
// execute request
Cursor c = null;
try {
c = ctx.getContentResolver().query(cpUri,
null, null, null, null);
if (c == null || c.getCount() != 1) {
return null;
}
// get 'all' notes and return first
return createFieldNoteImages(c).get(0);
} finally {
Utils.closeQuietly(c);
}
}
示例7: logOnline
import locus.api.android.utils.exceptions.RequiredVersionMissingException; //导入依赖的package包/类
/**
* Log list of defined field notes online on Geocaching server.
*
* @param ctx existing context
* @param lv active Locus version
* @param ids list of FieldNote id's that should be logged
* @param createLog <code>true</code> if we wants to create a log directly, or
* <code>false</code> if note should be posted into FieldNotes section
* @throws RequiredVersionMissingException error in case, LocusVersion is not valid
*/
public static void logOnline(Context ctx, LocusUtils.LocusVersion lv,
long[] ids, boolean createLog) throws RequiredVersionMissingException {
// check parameters
if (ctx == null || lv == null || ids == null || ids.length == 0) {
throw new IllegalArgumentException("logOnline(" + ctx + ", " + lv + ", " + ids + "), " +
"invalid parameters");
}
// check version
if (!lv.isVersionValid(LocusUtils.VersionCode.UPDATE_05)) {
throw new RequiredVersionMissingException(LocusUtils.VersionCode.UPDATE_05);
}
// execute request
Intent intent = new Intent(LocusConst.ACTION_LOG_FIELD_NOTES);
intent.putExtra(LocusConst.INTENT_EXTRA_FIELD_NOTES_IDS, ids);
intent.putExtra(LocusConst.INTENT_EXTRA_FIELD_NOTES_CREATE_LOG, createLog);
ctx.startActivity(intent);
}
示例8: sendTrack
import locus.api.android.utils.exceptions.RequiredVersionMissingException; //导入依赖的package包/类
private static boolean sendTrack(String action, Context context, Track track,
boolean callImport, boolean centerOnData, boolean startNavigation)
throws RequiredVersionMissingException {
// check track
if (track == null || track.getPoints().size() == 0) {
Logger.logE(TAG, "sendTrack(" + action + ", " + context + ", " + track + ", " +
callImport + ", " + centerOnData + ", " + startNavigation + "), " +
"track is null or contain no points");
return false;
}
// create and start intent
Intent intent = new Intent();
intent.putExtra(LocusConst.INTENT_EXTRA_TRACKS_SINGLE, track.getAsBytes());
intent.putExtra(LocusConst.INTENT_EXTRA_START_NAVIGATION, startNavigation);
return sendData(action, context, intent, callImport, centerOnData);
}
示例9: handleTrackToolsMenu
import locus.api.android.utils.exceptions.RequiredVersionMissingException; //导入依赖的package包/类
private static void handleTrackToolsMenu(final MainActivity act, Intent intent)
throws RequiredVersionMissingException {
final Track track = LocusUtils.handleIntentTrackTools(act, intent);
if (track == null) {
Toast.makeText(act, "Wrong INTENT - no track!", Toast.LENGTH_SHORT).show();
} else {
new AlertDialog.Builder(act).
setTitle("Intent - On Track action").
setMessage("Received intent with track:\n\n" + track.getName() + "\n\ndesc:" + track.getParameterDescription()).
setNegativeButton("Close", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// just do some action on required coordinates
}
}).show();
}
}
示例10: getDataLocusInfo
import locus.api.android.utils.exceptions.RequiredVersionMissingException; //导入依赖的package包/类
/**
* Get LocusInfo container with various Locus app parameters.
* @param ctx current context
* @param lv required Locus version
* @return loaded info container or 'null' in case of problem
* @throws RequiredVersionMissingException if Locus in required version is missing
*/
public static LocusInfo getDataLocusInfo(Context ctx, LocusVersion lv)
throws RequiredVersionMissingException {
// get scheme if valid Locus is available
Uri scheme = getProviderUriData(lv, VersionCode.UPDATE_13,
LocusConst.CONTENT_PROVIDER_PATH_DATA + "/" + LocusConst.VALUE_LOCUS_INFO);
// execute action
Cursor cursor = null;
try {
byte[] data = queryData(ctx, scheme, null, LocusConst.VALUE_LOCUS_INFO);
if (data != null && data.length > 0) {
return new LocusInfo(data);
}
} catch (Exception e) {
Logger.logE(TAG, "getDataLocusInfo(" + ctx + ", " + lv + ")", e);
}
return null;
}
示例11: getDataUpdateContainer
import locus.api.android.utils.exceptions.RequiredVersionMissingException; //导入依赖的package包/类
/**
* Get #UpdateContainer container with current fresh data based on users activity.
* @param ctx current context
* @param lv required Locus version
* @return loaded update container or 'null' in case of problem
* @throws RequiredVersionMissingException if Locus in required version is missing
*/
public static UpdateContainer getDataUpdateContainer(Context ctx, LocusVersion lv)
throws RequiredVersionMissingException {
// get scheme if valid Locus is available
Uri scheme = getProviderUriData(lv, VersionCode.UPDATE_13,
LocusConst.CONTENT_PROVIDER_PATH_DATA + "/" + LocusConst.VALUE_UPDATE_CONTAINER);
// execute action
Cursor cursor = null;
try {
byte[] data = queryData(ctx, scheme, null, LocusConst.VALUE_UPDATE_CONTAINER);
if (data != null && data.length > 0) {
return new UpdateContainer(data);
}
} catch (Exception e) {
Logger.logE(TAG, "getDataUpdateContainer(" + ctx + ", " + lv + ")", e);
}
return null;
}
示例12: actionStartNavigation
import locus.api.android.utils.exceptions.RequiredVersionMissingException; //导入依赖的package包/类
/**
* Intent that starts navigation in Locus app based on defined target.
* @param act current activity
* @param name name of target
* @param latitude latitude of target
* @param longitude longitude of target
* @throws RequiredVersionMissingException if Locus in required version is missing
*/
public static void actionStartNavigation(Activity act,
String name, double latitude, double longitude)
throws RequiredVersionMissingException {
// check required version
if (!LocusUtils.isLocusAvailable(act, VersionCode.UPDATE_01)) {
throw new RequiredVersionMissingException(VersionCode.UPDATE_01);
}
// call Locus
Intent intent = new Intent(LocusConst.ACTION_NAVIGATION_START);
if (name != null) {
intent.putExtra(LocusConst.INTENT_EXTRA_NAME, name);
}
intent.putExtra(LocusConst.INTENT_EXTRA_LATITUDE, latitude);
intent.putExtra(LocusConst.INTENT_EXTRA_LONGITUDE, longitude);
act.startActivity(intent);
}
示例13: actionStartGuiding
import locus.api.android.utils.exceptions.RequiredVersionMissingException; //导入依赖的package包/类
/**************************************************/
public static void actionStartGuiding(Activity act,
String name, double latitude, double longitude)
throws RequiredVersionMissingException {
if (LocusUtils.isLocusAvailable(act, 243, 243, 0)) {
Intent intent = new Intent(LocusConst.ACTION_GUIDING_START);
if (name != null) {
intent.putExtra(LocusConst.INTENT_EXTRA_NAME, name);
}
intent.putExtra(LocusConst.INTENT_EXTRA_LATITUDE, latitude);
intent.putExtra(LocusConst.INTENT_EXTRA_LONGITUDE, longitude);
act.startActivity(intent);
} else {
throw new RequiredVersionMissingException(243);
}
}
示例14: updateLocusWaypoint
import locus.api.android.utils.exceptions.RequiredVersionMissingException; //导入依赖的package包/类
/**
* Update waypoint in Locus
* @param ctx current context
* @param wpt waypoint to update. Do not modify waypoint's ID value, because it's key to update
* @param forceOverwrite if set to <code>true</code>, new waypoint will completely rewrite all
* user's data (do not use if necessary). If set to <code>false</code>, Locus will handle update based on user's
* settings (if user have defined "keep values", it will keep it)
* @param loadAllGcWaypoints allow to force Locus to load all GeocacheWaypoints (of course
* if point is Geocache and is visible on map)
* @return number of affected waypoints
* @throws RequiredVersionMissingException if Locus in required version is missing
*/
public static int updateLocusWaypoint(Context ctx, LocusVersion lv,
Waypoint wpt, boolean forceOverwrite, boolean loadAllGcWaypoints)
throws RequiredVersionMissingException {
// check version (available only in Free/Pro)
int minVersion = VersionCode.UPDATE_01.vcFree;
if (!LocusUtils.isLocusFreePro(lv, minVersion)) {
throw new RequiredVersionMissingException(minVersion);
}
// generate cursor
Uri scheme = getProviderUriData(lv, VersionCode.UPDATE_01,
LocusConst.CONTENT_PROVIDER_PATH_WAYPOINT);
// define empty cursor
ContentValues cv = new ContentValues();
cv.put("waypoint", wpt.getAsBytes());
cv.put("forceOverwrite", forceOverwrite);
cv.put("loadAllGcWaypoints", loadAllGcWaypoints);
return ctx.getContentResolver().update(scheme, cv, null, null);
}
示例15: displayWaypointScreen
import locus.api.android.utils.exceptions.RequiredVersionMissingException; //导入依赖的package包/类
/**
* Allows to display whole detail screen of certain waypoint.
* @param ctx current context
* @param lv LocusVersion we call
* @param wptId ID of waypoints we wants to display
* @param callback generated callback (optional)
* @throws RequiredVersionMissingException if Locus in required version is missing
*/
private static void displayWaypointScreen(Context ctx, LocusVersion lv, long wptId, String callback)
throws RequiredVersionMissingException {
// check version (available only in Free/Pro)
if (!LocusUtils.isLocusFreePro(lv, VersionCode.UPDATE_07.vcFree)) {
throw new RequiredVersionMissingException(VersionCode.UPDATE_07);
}
// call intent
Intent intent = new Intent(LocusConst.ACTION_DISPLAY_POINT_SCREEN);
intent.putExtra(LocusConst.INTENT_EXTRA_ITEM_ID, wptId);
if (callback != null && callback.length() > 0) {
intent.putExtra(Waypoint.TAG_EXTRA_CALLBACK, callback);
}
ctx.startActivity(intent);
}