我正在开发一个使用BLE的iOS 5应用程序,需要监视与蓝牙设备的连接几个小时。 我一直在使用我的plist中的bluetooth-central用于UIBackgroundModes,只要设备连接,它就能很好地保持应用程序的运行。 当它断开连接时,我尝试重新连接它,一旦设备再次开始广告,它 ...
提示:本站收集StackOverFlow近2千万问答,支持中英文搜索,鼠标放在语句上弹窗显示对应的参考中文或英文, 本站还提供 中文繁体 英文版本 中英对照 版本,有任何建议请联系yoyou2525@163.com。
我有一个使用google plus注册的应用,我的问题是:
调用mGoogleApiClient.connect();
然后除了等待gPlus的响应使onConnectionFailed
或onConnected
失败之外,我什么都不做。
但是,在等待它的同时,奇怪的事情发生了,我的手机屏幕变暗了,就像在必须弹出对话框但没有出现任何东西并且在1,2秒后关闭应用程序时一样。
但是该过程仍在运行,因为当onConnectionFailed
或onConnected
被击中(断点)时,我可以在调试器中捕获它们并沿语句移动,但该应用程序(视图)已通过移动设备关闭。
有人可以解释为什么会发生这种情况以及如何解决此问题吗?
private void activateGooglePlusLogin() {
SignInButton googlePlusSignInButton = (SignInButton) findViewById(R.id.googlePlusSignInButton);
googlePlusSignInButton.setSize(SignInButton.SIZE_WIDE);
googlePlusSignInButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View arg0) {
try {
eGooglePlus googleApiObj = new eGooglePlus(Splash.this);
googleApiObj.connectGoogleApi();
TextView pleaseWait = (TextView) findViewById(R.id.pleaseWait);
pleaseWait.setText("Please wait while we register your account...");
//waitForNSeconds(10000);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
public void connectGoogleApi() {
mGoogleApiClient = new GoogleApiClient.Builder(mainAppContext).addConnectionCallbacks(this).addOnConnectionFailedListener(this).addApi(Plus.API).addScope(Plus.SCOPE_PLUS_LOGIN).build();
mGoogleApiClient.connect();
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.