Package fi.moprim.tmd.sdk
Class TmdContentProvider
- java.lang.Object
-
- android.content.ContentProvider
-
- fi.moprim.tmd.sdk.TmdContentProvider
-
- All Implemented Interfaces:
android.content.ComponentCallbacks
,android.content.ComponentCallbacks2
public class TmdContentProvider extends android.content.ContentProvider
The TmdContentProvider should enable access to - TmdActivity data - TmdStats data - TmdStatus data (idle, etc..)
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
TMD_ACTIVITY_ITEM_MIME_TYPE
MIME type for tmd activity itemstatic java.lang.String
TMD_ACTIVITY_LIST_MIME_TYPE
MIME type for tmd activity liststatic java.lang.String
TMD_STATS_ITEM_MIME_TYPE
MIME type for tmd stats itemstatic java.lang.String
TMD_STATS_LIST_MIME_TYPE
MIME type for tmd stats liststatic java.lang.String
VEHICLE_PROFILE_ITEM_MIME_TYPE
MIME type for vehicle profile itemstatic java.lang.String
VEHICLE_PROFILE_LIST_MIME_TYPE
MIME type for vehicle profile list
-
Constructor Summary
Constructors Constructor Description TmdContentProvider()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
attachInfo(android.content.Context context, android.content.pm.ProviderInfo info)
This function is used to initialise the URI matcherint
delete(android.net.Uri uri, java.lang.String selection, java.lang.String[] selectionArgs)
static java.lang.String
getAuthority(android.content.Context context)
Returns the authority string for this content providerstatic android.net.Uri
getTmdActivityUri(android.content.Context context)
Returns the URI to retrieve TMD activity data from the providerstatic android.net.Uri
getTmdActivityUri(android.content.Context context, long id)
Returns the URI to retrieve TMD activity data from the providerstatic android.net.Uri
getTmdStatsUri(android.content.Context context)
Returns the URI to retrieve TMD Stats data from the providerstatic android.net.Uri
getTmdStatsUri(android.content.Context context, long id)
Returns the URI to retrieve TMD Stats data from the providerstatic android.net.Uri
getTmdStatusUri(android.content.Context context)
Returns the URI to retrieve TMD Status data from the providerstatic android.net.Uri
getTmdStatusUri(android.content.Context context, long id)
Returns the URI to retrieve TMD Status data from the providerjava.lang.String
getType(android.net.Uri uri)
Returns the MIME type for a specific URI TODO add the other URIsstatic android.net.Uri
getVehicleProfileUri(android.content.Context context)
Returns the URI to retrieve TMD activity data from the providerstatic android.net.Uri
getVehicleProfileUri(android.content.Context context, java.lang.String id)
Returns the URI to retrieve TMD activity data from the providerandroid.net.Uri
insert(android.net.Uri uri, android.content.ContentValues values)
boolean
onCreate()
android.database.Cursor
query(android.net.Uri uri, java.lang.String[] projection, java.lang.String selection, java.lang.String[] selectionArgs, java.lang.String sortOrder)
void
shutdown()
int
update(android.net.Uri uri, android.content.ContentValues values, java.lang.String selection, java.lang.String[] selectionArgs)
-
Methods inherited from class android.content.ContentProvider
applyBatch, applyBatch, bulkInsert, call, call, canonicalize, clearCallingIdentity, delete, dump, getCallingAttributionSource, getCallingAttributionTag, getCallingPackage, getCallingPackageUnchecked, getContext, getPathPermissions, getReadPermission, getStreamTypes, getWritePermission, insert, isTemporary, onCallingPackageChanged, onConfigurationChanged, onLowMemory, onTrimMemory, openAssetFile, openAssetFile, openFile, openFile, openFileHelper, openPipeHelper, openTypedAssetFile, openTypedAssetFile, query, query, refresh, requireContext, restoreCallingIdentity, setPathPermissions, setReadPermission, setWritePermission, uncanonicalize, update
-
-
-
-
Field Detail
-
TMD_STATS_LIST_MIME_TYPE
public static final java.lang.String TMD_STATS_LIST_MIME_TYPE
MIME type for tmd stats list- See Also:
- Constant Field Values
-
TMD_STATS_ITEM_MIME_TYPE
public static final java.lang.String TMD_STATS_ITEM_MIME_TYPE
MIME type for tmd stats item- See Also:
- Constant Field Values
-
TMD_ACTIVITY_LIST_MIME_TYPE
public static final java.lang.String TMD_ACTIVITY_LIST_MIME_TYPE
MIME type for tmd activity list- See Also:
- Constant Field Values
-
TMD_ACTIVITY_ITEM_MIME_TYPE
public static final java.lang.String TMD_ACTIVITY_ITEM_MIME_TYPE
MIME type for tmd activity item- See Also:
- Constant Field Values
-
VEHICLE_PROFILE_LIST_MIME_TYPE
public static final java.lang.String VEHICLE_PROFILE_LIST_MIME_TYPE
MIME type for vehicle profile list- See Also:
- Constant Field Values
-
VEHICLE_PROFILE_ITEM_MIME_TYPE
public static final java.lang.String VEHICLE_PROFILE_ITEM_MIME_TYPE
MIME type for vehicle profile item- See Also:
- Constant Field Values
-
-
Method Detail
-
getAuthority
public static java.lang.String getAuthority(@NonNull android.content.Context context)
Returns the authority string for this content provider- Parameters:
context
- the context where the provider are being used- Returns:
- the authority string for this content provider
-
getTmdStatsUri
public static android.net.Uri getTmdStatsUri(@NonNull android.content.Context context)
Returns the URI to retrieve TMD Stats data from the provider- Parameters:
context
- the context where the provider are being used- Returns:
- the URI to retrieve TMD Stats data from the provider
-
getTmdStatsUri
public static android.net.Uri getTmdStatsUri(@NonNull android.content.Context context, long id)
Returns the URI to retrieve TMD Stats data from the provider- Parameters:
context
- the context where the provider are being usedid
- the id of the TmdStats in the database- Returns:
- the URI to retrieve TMD Stats data from the provider
-
getTmdStatusUri
public static android.net.Uri getTmdStatusUri(@NonNull android.content.Context context)
Returns the URI to retrieve TMD Status data from the provider- Parameters:
context
- the context where the provider are being used- Returns:
- the URI to retrieve TMD Status data from the provider
-
getTmdStatusUri
public static android.net.Uri getTmdStatusUri(@NonNull android.content.Context context, long id)
Returns the URI to retrieve TMD Status data from the provider- Parameters:
context
- the context where the provider are being used- Returns:
- the URI to retrieve TMD Status data from the provider
-
getTmdActivityUri
public static android.net.Uri getTmdActivityUri(@NonNull android.content.Context context)
Returns the URI to retrieve TMD activity data from the provider- Parameters:
context
- the context where the provider are being used- Returns:
- the URI to retrieve TMD activity data from the provider
-
getTmdActivityUri
public static android.net.Uri getTmdActivityUri(@NonNull android.content.Context context, long id)
Returns the URI to retrieve TMD activity data from the provider- Parameters:
context
- the context where the provider are being used- Returns:
- the URI to retrieve TMD activity data from the provider
-
getVehicleProfileUri
public static android.net.Uri getVehicleProfileUri(@NonNull android.content.Context context)
Returns the URI to retrieve TMD activity data from the provider- Parameters:
context
- the context where the provider are being used- Returns:
- the URI to retrieve TMD activity data from the provider
-
getVehicleProfileUri
public static android.net.Uri getVehicleProfileUri(@NonNull android.content.Context context, java.lang.String id)
Returns the URI to retrieve TMD activity data from the provider- Parameters:
context
- the context where the provider are being used- Returns:
- the URI to retrieve TMD activity data from the provider
-
attachInfo
public void attachInfo(android.content.Context context, android.content.pm.ProviderInfo info)
This function is used to initialise the URI matcher- Overrides:
attachInfo
in classandroid.content.ContentProvider
- Parameters:
context
- the contextinfo
- the provider info
-
getType
public java.lang.String getType(@NonNull android.net.Uri uri)
Returns the MIME type for a specific URI TODO add the other URIs- Specified by:
getType
in classandroid.content.ContentProvider
- Parameters:
uri
- the URI- Returns:
- the MIME type for the URI
-
onCreate
public boolean onCreate()
- Specified by:
onCreate
in classandroid.content.ContentProvider
-
shutdown
public void shutdown()
- Overrides:
shutdown
in classandroid.content.ContentProvider
-
query
@Nullable public android.database.Cursor query(@NonNull android.net.Uri uri, @Nullable java.lang.String[] projection, @Nullable java.lang.String selection, @Nullable java.lang.String[] selectionArgs, @Nullable java.lang.String sortOrder)
- Specified by:
query
in classandroid.content.ContentProvider
-
insert
@Nullable public android.net.Uri insert(@NonNull android.net.Uri uri, @Nullable android.content.ContentValues values)
- Specified by:
insert
in classandroid.content.ContentProvider
-
delete
public int delete(@NonNull android.net.Uri uri, @Nullable java.lang.String selection, @Nullable java.lang.String[] selectionArgs)
- Specified by:
delete
in classandroid.content.ContentProvider
-
update
public int update(@NonNull android.net.Uri uri, @Nullable android.content.ContentValues values, @Nullable java.lang.String selection, @Nullable java.lang.String[] selectionArgs)
- Specified by:
update
in classandroid.content.ContentProvider
-
-