小编Mah*_*man的帖子

如何在Geofence android中添加后台服务

我正在尝试使用后台服务为监视器创建地理围栏.地理围栏创建成功并在应用程序活动打开时工作,但在关闭应用程序地理围栏时不起作用.我现在应该怎么做.我的代码是:

public class MapsActivity extends FragmentActivity implements OnMapReadyCallback,
    GoogleApiClient.ConnectionCallbacks,
    GoogleApiClient.OnConnectionFailedListener,
    LocationListener {


@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);
    // Obtain the SupportMapFragment and get notified when the map is ready to be used.
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);

    ref = FirebaseDatabase.getInstance().getReference("MyLocation");
    geoFire = new GeoFire(ref);
    mVerticalSeekBar = (VerticalSeekBar)findViewById(R.id.verticalSeekBar);

    setUpdateLocation();

}

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
    switch (requestCode) {
        case MY_PERMISSION_REQUEST_CODE:
            if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) { …
Run Code Online (Sandbox Code Playgroud)

android google-maps geofencing android-geofence geofire

13
推荐指数
1
解决办法
3689
查看次数

没有静态方法zzb - 当用户firebase-database和facebook帐户工具包时

当使用facebook时,firebase-database帐户工具包单独工作正常但是当我在项目中同时使用它们时它会给出错误 -

java.lang.NoSuchMethodError: No static method zzb(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object; in class Lcom/google/android/gms/common/internal/zzac; or its super classes (declaration of 'com.google.android.gms.common.internal.zzac' appears in /data/app/com.neccargo-2/split_lib_dependencies_apk.apk:classes14.dex)

我正在使用依赖 -

compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', 
{
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support:design:26.+'
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.android.support:recyclerview-v7:26.+'
    compile 'com.android.support:cardview-v7:26.+'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.facebook.android:account-kit-sdk:4.+'
    compile 'com.karumi:dexter:4.1.1'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.daimajia.slider:library:1.1.5@aar'
    compile 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'
    compile 'com.wdullaer:materialdatetimepicker:2.3.0'
    compile 'com.jakewharton:butterknife:8.7.0'
    compile 'com.flaviofaria:kenburnsview:1.0.7'
    compile 'com.google.firebase:firebase-database:10.0.1'
    testCompile 'junit:junit:4.12'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
}

apply plugin: 'com.google.gms.google-services'
Run Code Online (Sandbox Code Playgroud)

我很难找到解决方案.

java android facebook

6
推荐指数
1
解决办法
572
查看次数

无法解决:com.android.support:support-fragment:26.1.0

通过此问题链接标记我的问题,但问题与此问题不相似.原因是 - "com.android.support:support-fragment:26.1.0"依赖项未添加到我的项目中.这个问题有不同的原因和不同的错误.问题链接的答案也不适用于此问题.

我在我的电脑中并排使用Android Studio 2.3.3Android Studio 3.0 BETA 6.在我的项目中,我得到如下图像的错误 -

在此输入图像描述

我正在使用依赖 -

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })

    compile 'com.android.support:appcompat-v7:26.+'
    compile 'com.android.support:design:26.+'
    compile 'com.android.volley:volley:1.0.0'
    compile 'com.android.support:recyclerview-v7:26.+'
    compile 'com.android.support:cardview-v7:26.+'
    compile 'com.squareup.picasso:picasso:2.5.2'
    compile 'com.facebook.android:account-kit-sdk:4.+'
    compile 'com.karumi:dexter:4.1.1'
    compile 'com.nineoldandroids:library:2.4.0'
    compile 'com.daimajia.slider:library:1.1.5@aar'
    compile 'fr.avianey.com.viewpagerindicator:library:2.4.1.1@aar'
    compile 'com.wdullaer:materialdatetimepicker:2.3.0'
    compile 'com.jakewharton:butterknife:8.7.0'
    compile 'com.flaviofaria:kenburnsview:1.0.7'
    compile 'com.google.firebase:firebase-core:11.2.0'
    compile 'com.google.firebase:firebase-database:11.2.0'
    compile 'com.google.android.gms:play-services:11.2.0'
    compile 'com.android.support:multidex:1.0.1'
    testCompile 'junit:junit:4.12'
    annotationProcessor 'com.jakewharton:butterknife-compiler:8.7.0'
}
apply plugin: 'com.google.gms.google-services' …
Run Code Online (Sandbox Code Playgroud)

java android android-support-library

4
推荐指数
1
解决办法
7707
查看次数