When I use a precompiled Library the libtd:https://core.telegram.org/tdlib
When I execute the send method, it's like this:
TdApi.TdlibParameters authStateRequest = new TdApi.TdlibParameters();
authStateRequest.apiId = 157364;
authStateRequest.apiHash = "<censored>";
Client.send(new TdApi.SetTdlibParameters(authStateRequest),new AuthorizationRequestHandler());\
A mistake like this:
Sending error for request 1: Error { code = 30 message = "File "/td.binlog" can't be opened/created for reading and writing" }
How should I solve it?
You should specify a lot more tdlibParameters in order to properly init the library. The error happens because you haven't specified writable databaseDirectory, but there are a lot of other parameters which should be also set with a correct value in setTdlibParameters. And please don't publish your apiHash, it should be kept secret. I've removed apiHash from your message.
thank you.
I modified the code
TdApi.TdlibParameters authStateRequest = new TdApi.TdlibParameters();
authStateRequest.apiId = 157364;
authStateRequest.useMessageDatabase = true;
authStateRequest.useSecretChats = true;
authStateRequest.systemLanguageCode = PhoneUtils.getLocale(this).getISO3Language();
authStateRequest.deviceModel = PhoneUtils.getModel();
authStateRequest.systemVersion = PhoneUtils.getVersion();
authStateRequest.applicationVersion = "5.0.2";
authStateRequest.enableStorageOptimizer = true;
Client.send(new TdApi.SetTdlibParameters(authStateRequest));
Still appear this error
The error happens because you haven't specified writable databaseDirectory.
How can I specify a writable databaseDirectory?
On Android you can use getApplicationContext().getFilesDir().getAbsolutePath() for example.
thank you,this error is solved
Most helpful comment
On Android you can use getApplicationContext().getFilesDir().getAbsolutePath() for example.