我想制作一个简单的可穿戴应用程序并通过数据层连接.手持模块(使用:S5)一切正常,但可穿戴设备(使用:Moto 360)总是抛出错误:
onConnectionFailed:ConnectionResult {statusCode = SERVICE_VERSION_UPDATE_REQUIRED,resolution = null}
掌上电脑的播放服务是最新的
我已经添加
compile 'com.google.android.gms:play-services:7.3.0'
Run Code Online (Sandbox Code Playgroud)
对于两者,手持设备,作为磨损build.gradle.
可穿戴活动:
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        final WatchViewStub stub = (WatchViewStub) findViewById(R.id.watch_view_stub);
        stub.setOnLayoutInflatedListener(new WatchViewStub.OnLayoutInflatedListener() {
            @Override
            public void onLayoutInflated(WatchViewStub stub) {
                mTextView = (TextView) stub.findViewById(R.id.text);
            }
        });
        int result = GooglePlayServicesUtil.isGooglePlayServicesAvailable(this);
        Log.i(TAG,"Services available: "+ result);
        mGoogleApiClient = new GoogleApiClient.Builder(this)
                .addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {
                    @Override
                    public void onConnected(Bundle connectionHint) {
                        Log.d(TAG, "onConnected: " + connectionHint);
                        // Now you can use the Data Layer API
                    }
                    @Override …Run Code Online (Sandbox Code Playgroud) 在开发 Android 应用程序并尝试遵循干净的架构指南时,最好的方法是什么(但不是非常严格 - 因为这对于较小的项目来说可能是矫枉过正的)。
就我而言,我不确定哪种方法是最好的(如果有最好的)关于 数据层,以及数据层是否应该在自己的模型类上运行,或者它是否可以直接在域层模型上运行。
此外,如果数据层应该在自己的模型类上运行,数据源是否应该像DB或API拥有自己的模型(例如用于API使用Retrofit和Gson带有Gson注释的模型类),然后映射到数据层模型,或者数据层模型本身应该是DBand返回的模型API(这意味着必须对数据层模型进行注释,以便Gson能够在Retrofitand 的情况下解析它Gson)。
这个项目就是这种情况: https : //github.com/android10/Android-CleanArchitecture/blob/master/data/src/main/java/com/fernandocejas/android10/sample/data/entity/UserEntity.java
下面的图片应该阐明我的意思的 3 种方法:
在图 1 中,DB和API返回特定的模型类。在它的情况下,API它可能看起来像(使用Retrofit和Gson):
class ArticleResponse(@SerializedName("source") val source: SourceResponse,
                          @SerializedName("author") val author: String?,
                          @SerializedName("title") val title: String,
                          @SerializedName("description") val description: String?,
                          @SerializedName("url") val url: String,
                          @SerializedName("urlToImage") val …Run Code Online (Sandbox Code Playgroud) I am following Clean Architecture proposed by famous Robert C. Martin. The birds eye view of Clean Architecture looks like as follows:
However right now my concern about Repository pattern modification. Basics steps of Repository pattern are:
- Search in-memory cache AND provide data to app layer
 - If not found, search local data source AND sync to in-memory cache AND provide data to app layer
 - 如果没有找到,搜索远程数据源并同步到本地数据源并向应用层提供数据
 
严格按照上述步骤操作,如果本地数据源中存在数据,它将永远不会从远程数据源同步,而数据可能会在远程更改。我该如何修改才能处理这种情况?一个想法出现在我的脑海中,写在下面,但我确实在寻找更好的解决方案。
我的想法是跟踪本地数据库中每条记录的上次同步时间。如果上次同步时间超过阈值时间,则自动同步。
android repository-pattern data-layer restful-architecture clean-architecture
我想知道是否有可能在iframe及其父页面之间“同步” dataLayer。
情况:
我想做的是从iframe读取父级中的dataLayer,最好是通过代码管理器(宏)读取。可以从父页面更新该变量,但是iframe应该只读取数据。
这可能吗?Google对这个问题非常迷惑,我真的找不到合适的答案。
我正在尝试在我的标记中添加dataLayer变量值,但是当我查看Chrome中我的控制台的Network选项卡中触发的标记时,我看到标记已经填充了未定义的值,即使控制台中的dataLayer对象已经正确的价值观.
这是我在GTM中的dataLayer变量:
这是我访问标记内部的值的方法:
ORDERID={{ORDERID}}
这就是我在控制台中看到的dataLayer值:
但是在网络选项卡中,我看到dataLayer变量未定义:
这就是我的Tag Manager的DataLayer在预览模式下的样子: