最近几天出现了一个微不足道但又令人烦恼的问题.以前我的菜单选项弹出一个对话框,显示使用Google服务的法律文本非常全(如果加载有点慢),但现在它是null,代码没有变化.
GoogleApiAvailability apiAvailability = GoogleApiAvailability.getInstance();
int resultCode = apiAvailability.isGooglePlayServicesAvailable(this);
if (resultCode == ConnectionResult.SUCCESS) {
AlertDialog.Builder builder = new AlertDialog.Builder(MainActivity.this);
builder.setTitle("About");
builder.setMessage(apiAvailability.getOpenSourceSoftwareLicenseInfo(this));
builder.setPositiveButton("OK", null);
builder.show();
}
Run Code Online (Sandbox Code Playgroud)
这是否是其他人常见的问题,即Google更新引入的新错误或其他一些可能性?
我正在尝试使用本地Android来电UI。我有一个connectionService,并且成功注册了一个电话帐户。但是,在调用方法addNewIncomingCall之后,什么也没有发生。有什么我想念的想法吗?
表现...
<service
android:name=".MyConnectionService"
android:label="example"
android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE">
<intent-filter>
<action android:name="android.telecom.ConnectionService"/>
</intent-filter>
</service>
Run Code Online (Sandbox Code Playgroud)
活动...
TelecomManager tm = (TelecomManager) getSystemService(Context.TELECOM_SERVICE);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.M) {
PhoneAccountHandle phoneAccountHandle = new PhoneAccountHandle(
new ComponentName(this.getApplicationContext(), MyConnectionService.class),
"example");
PhoneAccount phoneAccount = PhoneAccount.builder(phoneAccountHandle, "example").setCapabilities(PhoneAccount.CAPABILITY_CALL_PROVIDER).build();
tm.registerPhoneAccount(phoneAccount);
Bundle extras = new Bundle();
Uri uri = Uri.fromParts(PhoneAccount.SCHEME_TEL, mNumber.getText().toString(), null);
extras.putParcelable(TelecomManager.EXTRA_INCOMING_CALL_ADDRESS, uri);
extras.putParcelable(TelecomManager.EXTRA_PHONE_ACCOUNT_HANDLE, phoneAccountHandle);
tm.addNewIncomingCall(phoneAccountHandle, extras);
}
Run Code Online (Sandbox Code Playgroud)
我希望至少能在onCreateIncomingConnection生成的日志中看到MyConnectionService
@RequiresApi(api = Build.VERSION_CODES.M)
public class MyConnectionService extends ConnectionService {
private static String TAG = "MyConnectionService";
public MyConnectionService() {
}
@Override
public Connection onCreateIncomingConnection(PhoneAccountHandle connectionManagerPhoneAccount, …Run Code Online (Sandbox Code Playgroud) 我需要一个服务在我的应用程序的后台运行,我希望它在手机开机时自动启动.我有通常的BOOT_COMPLETED意图过滤器但是会发生什么......
在我被要求锁定屏幕之前,我想要/需要工作.
这是在运行Android N的Pixel上.
干杯.