小编rig*_*roo的帖子

Android Things - 当我不知道IP地址时如何连接到我的Raspberry Pi

我已经成功地将Android Things Dev Preview安装到我的Raspberry Pi上.

我有一个问题.当我第一次开始安装自己的应用程序时,我能够通过以太网连接到Raspberry Pi,因为它在我启动Raspberry Pi时在电视上显示了IP地址.

现在因为我已经运行了一个应用程序的Raspberry Pi,当我启动它时,它会自动启动到我的应用程序而不显示带有IP地址的初始屏幕(我忘记了我的IP地址).

是否有一种简单的方法来获取Raspberry Pi的IP地址,或者在我不知道IP地址时连接到它?即使是获取网络上所有可用ADB设备列表的命令也会有所帮助.

如果连接到某个Wi-Fi,你可以运行如下命令:

adb network devices
Run Code Online (Sandbox Code Playgroud)

这可以列出您所在网络上的ADB设备列表.

android adb raspberry-pi3 android-things

16
推荐指数
2
解决办法
4485
查看次数

Android M 6.0 - SecurityException试图删除帐户

我有一个使用Android AccountManager(包名:com.mycompany.accounts)的应用程序,它将帐户添加到设备并提供登录屏幕.我有另一个应用程序(com.mycomp.actualapp),它使用第一个应用程序添加/删除帐户.

我可以使用清单中的以下权限在Pre Marshmallow设备上成功添加和删除帐户:

<uses-permission android:name="android.permission.GET_ACCOUNTS"/>
<uses-permission android:name="android.permission.MANAGE_ACCOUNTS"/>
<uses-permission android:name="android.permission.USE_CREDENTIALS"/>
Run Code Online (Sandbox Code Playgroud)

使用sdk 22进行编译并使用sdk 22进行编译时,应自动授予这些权限.以下代码:

      accountManager.removeAccount(getAccount(), activity, new AccountManagerCallback<Bundle>() {
        @Override
        public void run(AccountManagerFuture<Bundle> accountManagerFuture) {
            try {
                Bundle bundle = accountManagerFuture.getResult();
                boolean success = bundle.getBoolean(AccountManager.KEY_BOOLEAN_RESULT);
                if (success) {
                    Toast.makeText(activity, activity.getString(R.string.successfully_loggedout), Toast.LENGTH_LONG).show();
                    afterLogoutSuccess(activity);

                } else {
                    Toast.makeText(activity.getApplicationContext(), activity.getString(R.string.failed_to_logout), Toast.LENGTH_LONG).show();
                }
                onLogoutListener.onLogoutFinished(success);
                return;
            } catch (OperationCanceledException e) {
                Log.e(TAG,"Operation cancelled exception:", e);
            } catch (IOException e) {
                Log.e(TAG, "IOException:", e);
            } catch (AuthenticatorException e) {
                Log.e(TAG, "AuthenticatorException:", e);
            }
            onLogoutListener.onLogoutFinished(false);

        }
    }, null); …
Run Code Online (Sandbox Code Playgroud)

permissions android android-account android-securityexception android-6.0-marshmallow

7
推荐指数
1
解决办法
2548
查看次数