小编use*_*426的帖子

我应该用什么替换SCREEN_DIM_WAKE_LOCK?

我目前正在使用以下引用的代码来对警报通知活动进行唤醒锁定.但是,SCREEN_DIM_LOCK已经折旧了.那么,我应该用它替换它?

//Instance of wake lock for AlarmActivity
PowerManager pm = (PowerManager) this.getSystemService(Context.POWER_SERVICE);
wakeLock = pm.newWakeLock(PowerManager.SCREEN_DIM_WAKE_LOCK, "MyWakeLock");
Run Code Online (Sandbox Code Playgroud)

android powermanager

14
推荐指数
2
解决办法
9123
查看次数

setExpirationDuration(NEVER_EXPIRE)和setTransitionTypes(GEOFENCE_TRANSITION_ENTER)给出错误

在我构建地理围栏的方法中,我收到错误ExpirationDuration(NEVER_EXPIRE)setTransitionTypes(GEOFENCE_TRANSITION_ENTER)声明它们无法解析为变量.为什么会这样?

我的方法:

private void buildGeofence(){
    LatLng geofencePoint = marker.getPosition();
    int radius = 1610;
    Geofence.Builder geofence = new Geofence.Builder();
    geofence.setCircularRegion(geofencePoint.latitude,geofencePoint.longitude, radius);
    geofence.setExpirationDuration(NEVER_EXPIRE);
    geofence.setTransitionTypes(GEOFENCE_TRANSITION_ENTER);
    geofence.setNotificationResponsiveness(0);
    geofence.build();
}
Run Code Online (Sandbox Code Playgroud)

android android-geofence

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

将用户限制为地图上的一个标记

我在Android应用中使用Google Maps V2 API.我添加了一个方法,允许用户使用onMapLongClick放置一个可拖动的标记.我还计划将功能与SearchView小部件和Google Places结合使用.在这方面,我想限制用户能够在地图上只放置一个标记.如果他们调用任何一种方法再次放置标记,我希望现有标记将其位置更新为新输入.我已经研究了几天了,并且无法限制用户可以放置的标记数量1.关于如何实现这一点的任何想法?这是我现在使用的方法......

//onMapLongClick, create marker
@Override    
public void onMapLongClick(LatLng point) {
    map.addMarker(new MarkerOptions()
    .position(point)
    .title("Your Destination")           
    .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher))
    .draggable(true));
}
Run Code Online (Sandbox Code Playgroud)

android google-maps-android-api-2

0
推荐指数
1
解决办法
1125
查看次数