草庐IT

current_room

全部标签

android - 谷歌播放服务 : how to check if there is currently "active" pending intent callback registered to location updates/activity recognition?

我的应用程序在后台执行定期位置更新和Activity识别检测。我正在使用GooglePlayServicesAPI这样做:例如-要注册到位置更新,我提供接收更新的未决Intent:mLocationClient.requestLocationUpdates(mLocationRequest,pendingInent);要注销位置更新,我正在执行以下操作:mLocationClient.removeLocationUpdates(pendingInent);这很好,而且效果很好。但是我如何才能知道当前是否有一个pendingIntent持有我的应用程序组件的Intent当前是否已在Goo

android - 连接 ROOM 数据库中的表

这是我的第一个ROOM实现。我有一个User类,它有一个Pets列表作为其成员变量之一。publicclassUser{Stringid;Stringname;Listpets;}PublicclassPets{Stringid;Stringtype;}如何从以下JSON为房间数据库创建其实体和DAO类?{"users":[{"id":"as123","name":"John","pets":[{"id":"p123","type":"dog"}]},{"id":"as343","name":"Mark","pets":[{"id":"p324","type":"dog"},{"id"

android - 使用 LiveData 转换获取 Room 关系数据库值

Android和Java的新手,正在尝试通过制作应用来学习。但现在我无法正确获取关系数据并将其显示在RecyclerView中(使用ListAdapter和InfiniteScroll)。这是我到目前为止所做工作的要点。实体:项目:@Entity(...)publicclassItem{@PrimaryKey(autoGenerate=true)privatelongitem_id;@SerializedName("title")@ExposeprivateStringtitle="";@Ignore@SerializedName("labels")@ExposeprivateList

android - Android Room 数据库的几种不同崩溃 - 不知道为什么

我们最近在使用Android的Room数据库时遇到了一些问题。崩溃只发生在某些用户身上,但我无法在我的测试设备或模拟器上重现它。(这有时也会发生在Firebase测试设备上)有一些异常(exception)似乎都是相关的。所有这些异常都发生在我们Dao的不同行中,由Room生成。(查询、插入、更新或删除)。CursorWindowAllocationException:Cursorwindowallocationof2048kbfailed.IllegalStateException:attempttore-openanalready-closedobject:SQLiteDataba

Android:在 DAO 中使用 Room 数据库和 LiveData 的整洁架构

我正在尝试将整洁的架构方法应用到我的项目(Link:guideI'mcurrentlyreferencing)。我正在使用Room数据库进行本地存储,我希望它成为应用程序中的单一数据源-这意味着从网络调用收集的所有数据首先保存在数据库中,然后才传递给演示者。Room提供从其DAO返回的LiveData,这正是我需要的。不过,我也想使用存储库作为访问数据的单一方式。这是领域层(最抽象的一个)中存储库接口(interface)的示例:interfaceRepository{funfindByUsername(username:String):Listfunadd(entity:T):Lon

android - Zipping Room Flowable 阻止更新

我的存储库中有一个getPlaces方法:overridefungetPlaces(filter:FilterRequest):Flowable>{returnfrom(placesApi.filter(filter)).doOnSuccess{placesDao.savePlaces(it)}.flatMapPublisher{it->placesDao.getPlaces(it.map{it.placeId})}}此方法从api收集结果,然后将结果保存在数据库中,并返回一个flowable,其中包含id从数据库中检索到的那些地方作为Flowable:@Query("select*f

android - 与 Room 和 LiveData 的多对多关系

我有一个restapi,它返回一个地点列表,其中有一个类别列表:{"id":"35fds-45sdgk-fsd87","name":"Myawesomeplace","categories":[{"id":"cat1","name":"Category1"},{"id":"cat2","name":"Category2"},{"id":"cat3","name":"Category3"}]}所以使用改造我从远程服务器获得这些模型类:dataclassCategory(varid:String,varname:String)dataclassPlace(varid:String,varn

Android - PendingIntent.FLAG_CANCEL_CURRENT - 它真的取消了 alarmManager 之前未决的 Intent 吗?

我有以下代码,它只运行一个警报管理器:publicvoidrunAlarm(){Intentintent=newIntent(context,MyReceiver.class);intent.setAction(ACTION_TIMEOUT);PendingIntentalarmIntent=PendingIntent.getBroadcast(context,0,intent,PendingIntent.FLAG_CANCEL_CURRENT);setTimeOutAlarm(TIMEOUT_MINUTES,alarmIntent);AlarmManageralarmMgr=(Ala

Android Room Kotlin - 后台线程查询 - 返回值问题

我已经将示例程序从Java/SQLite转换为Kotlin/Room。我正在努力在后台线程中实现具有返回值的查询。这已被问到,但我无法让它工作。我已经阅读了类似问题的答案,但有些已被弃用,或者某些解决方案对于应该微不足道的事情来说似乎很复杂。当我需要使用查询的返回值时,我真的很难想出一个简单的解决方案。(如果我强制在主线程中使用allowMainThreadQueries()进行查询,一切都会正常进行)这是我希望在后台线程中执行查询的功能之一:fungetCrimes():List{valcrimes=crimesDAO.getAllCrimes()asArrayListreturnc

java - Android Room Persistence Library 在库项目中不起作用

我正在开发一个Android库,并想在其中使用新的AndroidRoom持久性库。但是,启动时出现此错误:Causedby:java.lang.RuntimeException:cannotfindimplementationforMyLibraryName.Database.QSDatabase.QSDatabase_Impldoesnotexistatandroid.arch.persistence.room.Room.getGeneratedImplementation(Room.java:90)这意味着annotationProcessor不会在编译期间生成额外的代码。顺便说一