如何为Sony Smart Glass注册应用程序?

时间:2016-08-02 07:08:35

标签: android-studio sony-smarteyeglass

我正在尝试在Android Studio 2.1.2中为Sony Smart Glass开发应用程序。我编写了编码,现在我必须注册应用程序,以便Smart Connect可以识别应用程序,以便它可以用于索尼智能玻璃。

索尼已经提供了很少的注册说明,但我无法理解。不过我尽力注册。我得到了大约13个错误。我在下面发布了我的编码。

  @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        final Intent intent = this.getIntent()
        mUserEmail = intent.getStringExtra(Constants.USER_EMAIL);
        setContentView(R.layout.search_list_activity);
        RecyclerView mRecy = (RecyclerView) findViewById(R.id.rv_ff);
        mProgBar = (ProgressBar) findViewById(R.id.prog_bar_ff);
        mRecy.setLayoutManager(new LinearLayoutManager(this));
        mImageView = (ImageView) findViewById(R.id.iv_ff);
        nothingToShow = (ImageView) findViewById(R.id.nothing_to_show_here);

        Toolbar  toolbar = (Toolbar) findViewById(R.id.app_bar);

        /* Common toolbar setup */
        setSupportActionBar(toolbar);
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setDisplayShowHomeEnabled(true);

        searchEditText = (EditText) findViewById(R.id.search_edit_text);
        Log.d(TAG+"init","search");
        mQueryString = searchEditText.getText().toString();
        Log.d(TAG+"mQuery",mQueryString);
        searchEditText.setOnEditorActionListener(new EditText.OnEditorActionListener() {
            @Override
            public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
                if (actionId == EditorInfo.IME_ACTION_DONE) {
                    Log.d(TAG+"mQuery",mQueryString);
                    return true;
                }
                return false;
            }
        });

        mAdapter = new OfferAdapter(this);
        mRecy.setAdapter(mAdapter);
    }

错误:

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);
}
}

1 个答案:

答案 0 :(得分:0)

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

  • 创建一个扩展RegistrationInformation的类。
  • 覆盖方法以定义使用的API版本。
  • 覆盖getExtensionRegistrationConfiguration()方法以定义应用的注册信息。
  • 覆盖isDisplaySizeSupported()方法以定义您的应用支持哪些附件。
  • 在ExtensionService类中返回RegistrationInformation的实例。