【问题标题】:Adding .aidl interafce in android studio在android studio中添加.aidl接口
【发布时间】:2019-04-17 00:48:35
【问题描述】:

我在特定的aidl文件夹中有两个.adil接口,但它也无法识别我的文件。我已按照以下步骤操作: I have followed these steps in stackoverflow

我的 .aidl 文件是:

interface IControllerInterface {
/**
 * Init IPCController.
 * @param cmd_type Only support Wearable SDK Controller CMD_8 or CMD_9
 * @param tagName Controller Tag
 */
int init(int cmd_type, in String tagName);

/**
 * Send bytes to Wearable.
 * @param tagName Controller Tag, use your IPCController init tag.
 * @param cmd command string, like "yahooweather yahooweather 1 0 0 "
 * @param dataBuffer byte type of data, like "".getBytes()
 * @param priority default PRIORITY_NORMAL, if set as PRIORITY_HIGH, this session
 *        will get top priority to send.
 */
long sendBytes(in String tagName, String cmd, in byte[] data, int priority);

/**
 * Return connection state.
 * 
 * @see WearableManager#STATE_NONE
 * @see WearableManager#STATE_LISTEN
 * @see WearableManager#STATE_CONNECT_FAIL
 * @see WearableManager#STATE_CONNECT_LOST
 * @see WearableManager#STATE_CONNECTING
 * @see WearableManager#STATE_CONNECTED
 * @see WearableManager#STATE_DISCONNECTING
 */
int getConnectionState();

/**
 * Destroy the IPCController.
 */
void close(String tagName);

/**
 * register IControllerCallback for the "tagName" IPCController.
 */
void registerControllerCallback(in String tagName, in IControllerCallback callback);

/**
 * unregister IControllerCallback for the "tagName" IPCController.
 */
void unregisterControllerCallback(in String tagName, in IControllerCallback callback);

/**
 * get SmartDevice APK remote Bluetooth device Name.
 */
String getRemoteDeviceName();

}

这是我需要扩展的类:

private class ControllerBinder extends IControllerInterface.Stub {

}

【问题讨论】:

    标签: java android android-studio aidl


    【解决方案1】:

    我已经用Android Official documentation 完成了这项工作。并找到了我的问题的根本原因。我上面发布的代码在我的案例中使用了另一个aidl接口。 IControllerInterface 找不到 IControllerCallback 接口。 请告诉我如何将一个aidlinterface 访问到另一个aidl 接口。

    【讨论】:

    • 你需要将 IControllerCallback 导入到 IControllerInterface.aidl 文件中,并带有完整的包名
    猜你喜欢
    • 2022-07-13
    • 2013-05-11
    • 1970-01-01
    • 1970-01-01
    • 2013-05-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多