相关疑难解决方法(0)

Android Geofence最终停止获得过渡意图

我有一个以Google的地理围栏示例代码开头的应用.它可以工作几天,我得到了所有过渡意图,正如我预期的那样.然而,经过一段时间,比如3天,应用程序停止了这些意图,我不知道为什么.

当我创建我的围栏时,我将到期时间设置为Geofence.NEVER_EXPIRE

这是我的IntentService,我在它停止工作之前获得转换意图:

public class ReceiveTransitionsIntentService extends IntentService {
    @Override
    protected void onHandleIntent(Intent intent) {

        Intent broadcastIntent = new Intent();

        broadcastIntent.addCategory(GeofenceUtils.CATEGORY_LOCATION_SERVICES);

        // First check for errors
        if (LocationClient.hasError(intent)) {
                ...handle errors
        } else {

            // Get the type of transition (entry or exit)
            int transition = LocationClient.getGeofenceTransition(intent);

            // Test that a valid transition was reported
            if ((transition == Geofence.GEOFENCE_TRANSITION_ENTER)
                    || (transition == Geofence.GEOFENCE_TRANSITION_EXIT)) {

                // Post a notification
                NEVER GETS HERE
            } else {
                ...log error
            }
        }
    }
} …
Run Code Online (Sandbox Code Playgroud)

android-geofence

33
推荐指数
1
解决办法
2万
查看次数

权限拒绝:从pid = -1访问服务ComponentInfo {...}

我正在尝试使用Google的活动识别服务.几天前,一切都像魅力一样,即我可以连接使用服务来获取活动信息.但今天我发现我再也收不到了.看完日志后我发现了这个错误:

 05-15 21:19:27.196: W/ActivityManager(765): Permission Denial: Accessing service
 ComponentInfo{edu.umich.si.inteco.captureprobe/edu.umich.si.inteco.captureprobe.
 contextmanager.ActivityRecognitionService} from pid=-1, uid=10220 that is not exported   
 from uid 10223
Run Code Online (Sandbox Code Playgroud)

我重新启动了手机,然后又恢复了工作.但是,在我重新安装应用程序后,再次出现同样的问题.谁能指出"真正的"问题会是什么?它与"pid = -1"有关吗?我在Manifest文件中有权限

<uses-permission android:name="com.google.android.gms.permission.ACTIVITY_RECOGNITION"/>
Run Code Online (Sandbox Code Playgroud)

我在Google上寻找答案,但大多数问题是他们没有在清单文件中添加权限.这在我看来只是一个不同的问题......任何人都可以帮助我吗?谢谢!

更新:重新启动手机始终可以解决问题.但是,当我卸载应用程序并通过Eclipse重新安装它时,它总会重新出现.一致但奇怪的模式(至少对我而言).我想知道手机是否记得该应用并在我卸载后停止访问Google Play服务(或者出于某种原因Google Play服务不允许我的应用访问它).有任何想法吗?

permissions android google-play-services

11
推荐指数
1
解决办法
4992
查看次数

地理围栏没有触发

我正试图Geofence在我的APP 上实现,问题是当我在我标记的地方时不会触发.

我做的是我从地方选择器设置Latitude&.Longitude

我得到的价值很好,因为我把它放在google maps正确的位置,因为我已经阅读了许多人从lat/long设置错误值的答案.

我有两个班:GeofenceSingleton.classGeofenceTransitionsIntentService.

GeofenceSingleton.class样子:

public class GeofenceSingleton implements GoogleApiClient.ConnectionCallbacks, GoogleApiClient.OnConnectionFailedListener, ResultCallback<Status> {

private GoogleApiClient googleApiClient;
private static GeofenceSingleton _singleInstance;
private static Context appContext;
private static final String ERR_MSG = "Application Context is not set!! " +
        "Please call GeofenceSngleton.init() with proper application context";
private PendingIntent mGeofencePendingIntent;
private static ArrayList<Geofence> mGeofenceList;


private GeofenceSingleton() {
    if (appContext == null)
        throw new IllegalStateException(ERR_MSG);

    this.googleApiClient …
Run Code Online (Sandbox Code Playgroud)

android google-maps geofencing

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