com.craftar
Class CraftAROnDeviceCollectionManager
- java.lang.Object
-
- com.craftar.CraftAROnDeviceCollectionManager
public class CraftAROnDeviceCollectionManager extends java.lang.Object
The collection manager allows to add collections of images to the device. The collections are in the form of a Bundle file that can be downloaded from CraftAR. A collection Bundle encapsulates the database for a given collection in CraftAR.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class and Description static interface
CraftAROnDeviceCollectionManager.AddCollectionListener
Listener for the calls toaddCollection()
andaddCollectionWithToken()
static interface
CraftAROnDeviceCollectionManager.DeleteCollectionListener
Listener for the calls todeleteCollection()
static interface
CraftAROnDeviceCollectionManager.SyncCollectionListener
Listener for the calls tosyncCollection()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
addCollection(java.io.File bundleFile, CraftAROnDeviceCollectionManager.AddCollectionListener addCollectionListener)
Add a CraftARCollection to the device from a collectionBundlevoid
addCollection(java.lang.String bundleFileName, CraftAROnDeviceCollectionManager.AddCollectionListener addCollectionListener)
Add a CraftARCollection to the device from a collectionBundle stored in your application assets.void
addCollectionWithToken(java.lang.String token, CraftAROnDeviceCollectionManager.AddCollectionListener listener)
Add a CraftARCollection to the device downloading it's collectionBundle from CraftAR.void
addCollectionWithTokenAndTag(java.lang.String token, java.lang.String tag, CraftAROnDeviceCollectionManager.AddCollectionListener listener)
Add a CraftARCollection to the device downloading it's collectionBundle from CraftAR.boolean
clearCraftARMediaDirectory()
Deletes ALL the media's that has been downloaded from collection bundles.void
deleteCollection(CraftAROnDeviceCollection collection, CraftAROnDeviceCollectionManager.DeleteCollectionListener listener)
Remove a collection from the devicevoid
deleteCollection(java.lang.String collectionToken, CraftAROnDeviceCollectionManager.DeleteCollectionListener listener)
Remove a collection from the devicevoid
deleteCollection(java.lang.String collectionToken, java.lang.String tag, CraftAROnDeviceCollectionManager.DeleteCollectionListener listener)
Remove a collection from the deviceCraftAROnDeviceCollection
get(java.lang.String collectionToken)
Returns an object representing the CraftARCollection if it's available, null otherwise.CraftAROnDeviceCollection
get(java.lang.String collectionToken, java.lang.String tag)
Returns an object representing the CraftARCollection if it's available, null otherwise.static CraftAROnDeviceCollectionManager
Instance()
Get the singleton instance of the CraftAROnDeviceCollectionManager.java.util.Set<java.lang.String>
listCollections()
Get a list of uuids of the collections available on the devicevoid
setSyncURL(java.lang.String syncURL)
Sets the URL used for syncing the collection bundles.void
syncCollection(CraftAROnDeviceCollection collection, CraftAROnDeviceCollectionManager.SyncCollectionListener listener)
Sync a collection with the latest bundle available for your appID and SDK version.void
syncCollection(CraftAROnDeviceCollection collection, java.lang.String token, CraftAROnDeviceCollectionManager.SyncCollectionListener listener)
Sync a collection with the latest bundle available for your appID and SDK version.
-
-
-
Method Detail
-
Instance
public static CraftAROnDeviceCollectionManager Instance()
Get the singleton instance of the CraftAROnDeviceCollectionManager. Note that you must callCraftARSDK.Instance.init(Context c)
before doing this operation, otherwise it will return null
-
clearCraftARMediaDirectory
public boolean clearCraftARMediaDirectory()
Deletes ALL the media's that has been downloaded from collection bundles. This function can ONLY be called when there are no on-device collections in the device (will do nothing and return false otherwise). If you want to remove the media, you should first delete all the collections usingCraftARCollectionManager.deleteCollection()
- Returns:
- true if the media was removed successfully, false if the media could not be removed.
-
syncCollection
public void syncCollection(CraftAROnDeviceCollection collection, java.lang.String token, CraftAROnDeviceCollectionManager.SyncCollectionListener listener)
Sync a collection with the latest bundle available for your appID and SDK version. If there's a new bundle available, this method will download the new bundle and add it to the device.- Parameters:
collection
- Collection to synctoken
- Force the sync call to use this specific token (Could be useful if you want to revoke the token at some point, so an app does not longer sync).listener
- Listener that will receive the sync callbacks (progress, success, fail).
-
syncCollection
public void syncCollection(CraftAROnDeviceCollection collection, CraftAROnDeviceCollectionManager.SyncCollectionListener listener)
Sync a collection with the latest bundle available for your appID and SDK version. If there's a new bundle available, this method will download the new bundle and add it to the device.- Parameters:
collection
- Collection to synclistener
- Listener that will receive the sync callbacks (progress, success, fail).
-
setSyncURL
public void setSyncURL(java.lang.String syncURL)
Sets the URL used for syncing the collection bundles.
-
deleteCollection
public void deleteCollection(java.lang.String collectionToken, CraftAROnDeviceCollectionManager.DeleteCollectionListener listener)
Remove a collection from the device- Parameters:
collectionToken
- token for the collection to remove.listener
- Listener that is notified once the operation has been completed.
-
deleteCollection
public void deleteCollection(java.lang.String collectionToken, java.lang.String tag, CraftAROnDeviceCollectionManager.DeleteCollectionListener listener)
Remove a collection from the device- Parameters:
collectionToken
- token for the collection to remove.tag
- tag for the collection to remove.listener
- Listener that is notified once the operation has been completed.
-
deleteCollection
public void deleteCollection(CraftAROnDeviceCollection collection, CraftAROnDeviceCollectionManager.DeleteCollectionListener listener)
Remove a collection from the device- Parameters:
collection
- The collection to remove.listener
- The listener that is notified once the operation has been completed.
-
addCollection
public void addCollection(java.io.File bundleFile, CraftAROnDeviceCollectionManager.AddCollectionListener addCollectionListener)
Add a CraftARCollection to the device from a collectionBundle- Parameters:
bundleFile
- File that contains the collection bundleaddCollectionListener
- Listener that receives the callbacks
-
addCollectionWithToken
public void addCollectionWithToken(java.lang.String token, CraftAROnDeviceCollectionManager.AddCollectionListener listener)
Add a CraftARCollection to the device downloading it's collectionBundle from CraftAR.- Parameters:
token
- Collection token of the collection that you want to add.addCollectionListener
- Listener that receives the callbacks
-
addCollectionWithTokenAndTag
public void addCollectionWithTokenAndTag(java.lang.String token, java.lang.String tag, CraftAROnDeviceCollectionManager.AddCollectionListener listener)
Add a CraftARCollection to the device downloading it's collectionBundle from CraftAR.- Parameters:
token
- Collection token of the collection that you want to add.addCollectionListener
- Listener that receives the callbacks
-
addCollection
public void addCollection(java.lang.String bundleFileName, CraftAROnDeviceCollectionManager.AddCollectionListener addCollectionListener)
Add a CraftARCollection to the device from a collectionBundle stored in your application assets.- Parameters:
bundleFileName
- file path relative to assets/ where you have your bundle. For example, if your bundle is under assets/myCollectionBundle.zip, bundleFileName should be "myCollectionBundle.zip".addCollectionListener
- Listener that receives the callbacks
-
get
public CraftAROnDeviceCollection get(java.lang.String collectionToken)
Returns an object representing the CraftARCollection if it's available, null otherwise.
-
get
public CraftAROnDeviceCollection get(java.lang.String collectionToken, java.lang.String tag)
Returns an object representing the CraftARCollection if it's available, null otherwise.
-
listCollections
public java.util.Set<java.lang.String> listCollections()
Get a list of uuids of the collections available on the device- Returns:
-
-