用积雨城市SDK测试android程序
我是一个将cumulocity SDK与android程序集成的新手。 我想尝试积雨的例子,如下面的代码用积雨城市SDK测试android程序,android,cumulocity,Android,Cumulocity,我是一个将cumulocity SDK与android程序集成的新手。 我想尝试积雨的例子,如下面的代码 protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); final TextView mTextView = (TextView) findViewById(R.id.
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
final TextView mTextView = (TextView) findViewById(R.id.text1);
new AsyncTask<Object, Object, Object>() {
@Override
protected Object doInBackground(Object... arg0) {
Log.i("Richard debug","richard 1");
Platform platform = new PlatformImpl(
"https://developer.cumulocity.com", "<teanant id>", "<user>",
"<password>","<unknow>");
Log.i("Richard debug","richard 2");
InventoryApi inventory = platform.getInventoryApi();
Log.i("Richard debug","richard 3");
ManagedObjectRepresentation mo = new ManagedObjectRepresentation();
Log.i("Richard debug","richard 4");
mo.setName("Hello, Android!");
Log.i("Richard debug","richard 5");
mo = inventory.create(mo);
Log.i("Richard debug","URL: " + mo.getSelf());
return null;
}
}.execute();
}
我想这个函数可能有问题
platform = new PlatformImpl(host, port, tenantId, user, password, applicationKey);
我不知道这个函数中的“applicationKey”是什么。
所以我在参数中使用了“”
有没有一个熟悉的积云?
或者使用cumulocity server开发android程序的任何其他方法?我发现cumulocity提供了一种更方便的从服务器获取数据的方法。 我在android上尝试RESTAPI,并使用android volley库获取数据。
我解决了在android上开发应用程序的问题 应用程序密钥用于标识正在进行调用的应用程序。您可以在管理应用程序中使用“自己的应用程序”创建应用程序,并在其中设置应用程序密钥。出于测试目的,您可以简单地尝试将参数设置为“devicemanagement应用程序密钥”(在这种情况下,看起来设备管理将进行调用)。
platform = new PlatformImpl(host, port, tenantId, user, password, applicationKey);