正如标题所示,我正在尝试使用新的 Awareness API,它效果很好,但是 DetectedActivityFence 永远不会被触发,无论我做什么,有时它会在注册后立即触发,仅此而已。尝试使用 Moto G (XT1032) 和 Galaxy S4 (GT-I9500)。
其他围栏(例如 HeadphoneFence)工作得很好。快照 API 也运行良好,所以非常令人沮丧。
任何建议将不胜感激。谢谢!
android triggers broadcastreceiver android-geofence google-awareness
我正在尝试在应用程序中使用新的Awareness API,但我可以将其包含在我的代码中的唯一方法是使用
compile 'com.google.android.gms:play-services:9.2.0'
Run Code Online (Sandbox Code Playgroud)
在我的gradle文件中.
我试过用
compile 'com.google.android.gms:play-services-awareness:9.2.0'
Run Code Online (Sandbox Code Playgroud)
但似乎并不存在.
有谁知道选择性编译感知API的正确编译路径是什么?
提前致谢.
我想查看新的Awareness API,这是一个非常新的.我正在使用Play Services 9.0.2.该文档有这个例子:
GoogleApiClient client = new GoogleApiClient.Builder(context)
.addApi(Awareness.API)
.build();
client.connect();
Run Code Online (Sandbox Code Playgroud)
但是,没有提示需要添加哪些依赖项.任何的想法?
我对新的地图样式功能感兴趣,这个功能在9.6 Google Play Services版本中添加,但我也在使用Awareness API.在我的build.gradle我
compile 'com.google.android.gms:play-services-maps:9.6.1'
compile 'com.google.android.gms:play-services-contextmanager:9.6.1'
compile 'com.google.android.gms:play-services-location:9.6.1'
Run Code Online (Sandbox Code Playgroud)
和其他一些游戏服务/ firebase模块.以前v9.4工作,但现在我得到了Failed to resolve: com.google.android.gms:play-services-contextmanager:9.6.1
BTW,所有其他9.6版本的lib解析正确.我也尝试使用9.6.0和9. +,没有任何效果.
请不要建议添加, compile 'com.google.android.gms:play-services:9.6.1' 因为它会大大增加编译时间.
UPD:刚刚发现,活动识别包含在位置包中,所以我不需要意识.但这不是答案
在我的Android Studio中克隆Aware repo时,同步gradle,我得到以下消息:
无法同步Gradle项目'app'
错误:找不到com.google.android.gms:play-services-contextmanager:9.2.0.要求:Aware:app:unspecified
compile 'com.google.android.gms:play-services-contextmanager:9.2.0' 已经存在于我的build.gradle中
请参阅build.gradle:
apply plugin: 'com.android.application'
apply plugin: 'com.neenbedankt.android-apt'
android {
compileSdkVersion 23
buildToolsVersion "23.0.3"
defaultConfig {
applicationId "com.hitherejoe.aware"
minSdkVersion 21
targetSdkVersion 23
versionCode 1
versionName "1.0"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
testCompile 'junit:junit:4.12'
compile 'com.android.support:appcompat-v7:23.4.0'
compile 'com.google.android.gms:play-services-contextmanager:9.2.0'
compile 'com.android.support:design:23.0.1'
compile 'com.jakewharton:butterknife:8.1.0'
apt 'com.jakewharton:butterknife-compiler:8.1.0'
}
Run Code Online (Sandbox Code Playgroud)
需要帮助来构建项目.任何人都可以说我错过了什么?
我正在Android应用程序中实现谷歌Awareness API,但没有一个示例,也没有指南,显示如何在应用程序关闭或在后台收听API事件.我根据这里的答案写了一个全球接收器
<receiver android:name=".MyFenceReceiver" >
<intent-filter>
<action android:name="android.intent.action.FENCE_RECEIVER_ACTION" />
</intent-filter>
</receiver>
Run Code Online (Sandbox Code Playgroud)
但是,由于它不起作用,我怀疑我不知道用于拦截Awarness事件的正确意图过滤器.有没有人知道正确的意图过滤器,或者如果这不是我的问题,我如何在应用程序关闭时或在全局接收器的后台拦截API事件?
android intentfilter android-broadcastreceiver google-awareness