Closed bknill closed 7 years ago
Hi, Platform.initialize() is required. You must invoke it before using any other YICamera SDK functions. But this function is not required to invoke in onCreate(). You can invoke it in other place. You only need make sure it will be invoked at least once before invoking other YICamera SDK functions.
Hi, The problem is that I'm using this in a Cordova Plugin and I don't seem to be able to access the Platform.initialize() override, I think it's being initialised elsewhere or before this code is being called. As far as I can see, you only use it for
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Initialize YiCameraPlatform
try {
Platform.initialize(new Logger() {
@Override
public void verbose(String message) {
Log.v("YiCameraPlatform", message);
}
@Override
public void info(String message) {
Log.i("YiCameraPlatform", message);
}
@Override
public void warning(String message) {
Log.w("YiCameraPlatform", message);
}
@Override
public void error(String message) {
Log.e("YiCameraPlatform", message);
}
});
} catch (Exception ex) {
}
StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder().permitAll().build();
StrictMode.setThreadPolicy(policy);
pendingCameras = new ArrayList<>();
cameras = new ArrayList<>();
gridAdapter = new GridAdapter(this, cameras);
setContentView(R.layout.grid_activity);
gridView = (GridView) findViewById(R.id.gridView);
gridView.setAdapter(gridAdapter);
}
Which is setting the initial variables and adding those useless extra Log functions. I just need to remove those useless Log functions, i.e. make them all Log.i, or Log,d etc so it can use the generic Android Logger.
This seems like such a silly thing to block people from using this API from, it's not doing anything, just Logging messages - there is no obvious good reason why Log.info can't just stay as Log.i in your code!
Alternatively can you give access to the source code so I can just remove them?
The above code is just sample code in our sdk, you can modify it.
It's the source of the Jar I need to modify, just to remove the Log.infos, can I have access to that?
Or could you should me alternative way of setting the Logger to accept these extra methods when using Cordova?
Here's an updated question if you've got any thoughts on how to go about this
http://stackoverflow.com/questions/39629828/add-methods-to-cordova-log
Sorry, I know little about cordova. But the file is here: https://github.com/YITechnology/YIOpenAPI/blob/master/sdk/java/samples/YI360Demo/app/src/main/java/com/xiaoyi/yi360demo/GridActivity.java. I think you can modify it, right?
Yes.. That is what I have been doing. But please read the following very carefully.
I have completely given up using your API because of this. It's incredibly frustrating that something so small as a Log.info as opposed to the usual Log.i is completely blocking me.
If I could have the source code, I could change all the Log.infos to Log.i's and it would be fine. At the moment, the API is unusable.
Can you paste your code? I don't understand what you want to do. Platform.initializ() can ben invoked at any time. And this Platform is our sdk platform, not Cordova platform or Android SDK platform.
Ahh OK. That's where I was going wrong. I couldn't find where Platform.initialise() was coming from, Thanks. I'm in business.
Any chance you could release code with all Log.info removed, I'm trying to implement in a Cordova App and it's very hard to overide the initialisation function.
Here is a stackoverflow question about the subject http://stackoverflow.com/questions/39604196/cordova-plugin-override-platform-initialise