1

我试图在 Android Studio 2.1.2 中为 Sony Smart Glass 开发一个应用程序。我编写了代码,现在我必须注册应用程序,以便 Smart Connect 能够识别该应用程序,以便它可以用于 Sony Smart Glass。

索尼给出了几套注册说明,但我无法理解。尽管如此,我还是尽力注册了它。我收到大约 13 个错误。我在下面发布了我的编码。

package com.example.balakrishnan.newapp;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.Toast;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

 public class MainActivity extends AppCompatActivity implements RegistrationInformation {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
}

public void onButonTap(View v) {
    Toast myToast = Toast.makeText(getApplicationContext(), "sony smart glass", Toast.LENGTH_LONG);
    myToast.show();
}

public void browserapp(View view) {
    Intent browserIntent=new  Intent(Intent.ACTION_VIEW, Uri.parse("http://192.168.72.101/smartglass/datetime.php"));
    startActivity(browserIntent);
}

@Override
public int getRequiredControlApiVersion() {

    return 4;
}

@Override
public int getTargetControlApiVersion() {

    return 4;
}

@Override
public int getRequiredSensorApiVersion() {
    // Return 0 if the API is not required for your app
    return 0;
}

@Override
public boolean isDisplaySizeSupported(int width, int height) {
    boolean isSEG =
            (width == HelloLayoutsSEGControl.getSupportedControlWidth(mContext) &&
                    height == HelloLayoutsSEGControl.getSupportedControlHeight(mContext));

    return isSW2 || isSEG;

}

@Override
protected RegistrationInformation getRegistrationInformation() {
    return new SampleRegistrationInformation(this);
}
}

错误:

     Error:(13, 64) error: cannot find symbol class RegistrationInformation
     Error:(60, 15) error: cannot find symbol class RegistrationInformation
     Error:(37, 5) error: method does not override or implement a method from a supertype
    Error:(31, 5) error: method does not override or implement a method from a supertype
   Error:(43, 5) error: method does not override or implement a method from a supertype
   Error:(49, 5) error: method does not override or implement a method from a supertype
   Error:(52, 75) error: cannot find symbol variable mContext
   Error:(52, 27) error: cannot find symbol variable HelloLayoutsSEGControl
   Error:(53, 84) error: cannot find symbol variable mContext
   Error:(53, 35) error: cannot find symbol variable HelloLayoutsSEGControl
   Error:(55, 16) error: cannot find symbol variable isSW2
   Error:(59, 5) error: method does not override or implement a method from a supertype
   Error:(61, 20) error: cannot find symbol class       SampleRegistrationInformation
 :app:compileDebugJavaWithJavac FAILED
   Error:Execution failed for task ':app:compileDebugJavaWithJavac'.
  > Compilation failed; see the compiler error output for details.
4

1 回答 1

0

请按照以下步骤进行注册过程:

  • 创建一个扩展 RegistrationInformation 的类。
  • 覆盖方法以定义使用的 API 版本。
  • 覆盖 getExtensionRegistrationConfiguration() 方法以定义应用的注册信息。
  • 覆盖 isDisplaySizeSupported() 方法以定义您的应用支持哪些配件。
  • 在 ExtensionService 类中返回 RegistrationInformation 的实例。
于 2016-08-04T11:42:10.297 回答