Test android program with cumulocity SDK -
i new integrate cumulocity sdk android program. want try cumulocity example below code.
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(); }
}
when run "inventory.create(mo);" server return. //log
"caused by: com.cumulocity.android.sdk.sdkexception: server returned 401: unauthorized! "
i think problem maybe in function.
platform = new platformimpl(host, port, tenantid, user, password, applicationkey);
i don't know what's "applicationkey" in function. use "" in parameter.
is there have 1 familiar cumulocity android sdk? or other way developing android program cumulocity server?
i found cumulocity provide more convenient way data server. try rest api on android , use android volley library data. solve problem develope app on android.
Comments
Post a Comment