我可以使用我在身份验证后获得的凭据对Google驱动器进行身份验证和执行操作,但此令牌已存在很长时间.它说expours-in:3600所以它应该在1小时内到期但是当我在一个月之后尝试它它使用那个令牌并且它起作用了.
我的要求是在身份验证之后,无论正在执行的任务是否完成,如果用户再次启动程序,它应该再次向用户请求身份验证.所以基本上我不希望令牌存储在客户端的系统中.Expires-in对我来说不起作用,因为令牌被刷新并且不再要求身份验证.
下面是我正在使用的代码:
credential = GoogleWebAuthorizationBroker.AuthorizeAsync(
new ClientSecrets
{
ClientId = "<myid>.apps.googleusercontent.com",
ClientSecret = "<Mysecret>"
},
new[] { DriveService.Scope.Drive },
"user",
CancellationToken.None).Result;
// Create the service using the client credentials.
DriveService service = new DriveService(new BaseClientService.Initializer()
{
HttpClientInitializer = credential,
ApplicationName = "sampleapp"
});
*****some task performed*********
Run Code Online (Sandbox Code Playgroud)
现在在这个"一些任务"之后,我想让令牌被摧毁.
请帮忙.
我只是想知道我们是否可以专注于Android应用程序中添加的标记.如果有,怎么样?或者有没有其他方法来完成这项任务.
假设我使用下面的代码添加了一个标记:
map.addMarker(new MarkerOptions()
.title(title)
.snippet(snippet)
.icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_BLUE))
.position(pos)
);
Run Code Online (Sandbox Code Playgroud)
如何使用最大变焦对焦此标记.如果我要再添加一个标记,它应该以这样的方式调整缩放(最大可能的缩放),以便两个标记一次显示.
这就是我想要做的事情,但它是失败的map.moveCamera(cu);.
import java.util.ArrayList;
import java.util.List;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.view.Menu;
import com.google.android.gms.maps.CameraUpdate;
import com.google.android.gms.maps.CameraUpdateFactory;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.GoogleMap.CancelableCallback;
import com.google.android.gms.maps.SupportMapFragment;
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.LatLngBounds;
import com.google.android.gms.maps.model.Marker;
import com.google.android.gms.maps.model.MarkerOptions;
public class LocateUserInMap extends FragmentActivity {
private GoogleMap map;
private List<Marker> markers;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_locate_user_in_map);
markers = new ArrayList<Marker>();
Intent intent = getIntent();
double frndLatVal = intent.getDoubleExtra("frndLatVal", 0);
double frndLonVal …Run Code Online (Sandbox Code Playgroud)