2016-08-02 104 views
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. 
+0

好像你沒有在gradle文件中添加sony sdk。你是否? –

回答

0

按照以下步驟對註冊過程:

  • 創建擴展RegistrationInformation的類。
  • 重寫這些方法來定義所使用的API版本。
  • 重寫getExtensionRegistrationConfiguration()方法來定義應用程序的註冊信息。
  • 重寫isDisplaySizeSupported()方法來定義您的應用支持哪些配件。
  • 在您的ExtensionService類中返回RegistrationInformation的一個實例。
+0

是的,我已經遵循了這些給定的程序sony.since,因爲我們不能創建兩個公共類,出現問題 –