Author Message
riza87
Joined: Sep 29, 2017
Messages: 39
Offline
Hi All,

I want to implement auto configuration feature in custom app that the user just fill in the email then all the configurations automatically retrieve from the server. Is the SDK support this feature?because I don't know how to implement it.

Thanks and Regards,

Riza
Dmitry_Shikulin
Joined: Dec 20, 2016
Messages: 58
Offline
HI Riza,

Thank you for the question. The answer is No.
CSDK has no built-in functionality to retrieve configuration from server, parse it and configure itself.
This functionality should be implemented by UI side.
The only thing that can provide CSDK to help you is to actually download file from server.
CSDK has DownloadService and the methods inside: DownloadFile, RetrieveDataFromUrl, RetrieveTextFromUrl.

Regards,
Dmitry
test_123
Joined: Nov 6, 2017
Messages: 17
Offline
i have same question ,

i try to method DownloadServiceImpl fo download configuration from server (demoavaya.com) but stuck in parameter downloadServiceConfiguration . because I don't know how to implement it.
can you help me for this issue

Thanks
Andi
Dmitry_Shikulin
Joined: Dec 20, 2016
Messages: 58
Offline
Hi Andi,

Which platform do you use?

Here is the Windows example of config for DownloadService:

var config = new DownloadServiceConfiguration
{
AuthenticationMethodPreferences = new[] {AuthenticationMethod.Negotiate, AuthenticationMethod.BasicOrDigest},
CredentialProvider = credential != null ? new MyCredentialProvider(credential) : null
};

MyCredentialProvider inherits ICredentialProvider interface (in Avaya.ClientServices namespace)
and implement methods:

void OnAuthenticationChallenge(Challenge challenge, CredentialCallback credentialCallback);

void OnAuthenticationChallengeCancelled(Challenge challenge);

void OnCredentialAccepted(Challenge challenge);

The most interesting for you will be OnAuthenticationChallenge method where you should provide credentials into callback when event occurs:

void OnAuthenticationChallenge(Challenge challenge, CredentialCallback credentialCallback)
{
credentialCallback(new UserCredential(_credential.Username, _credential.Password));
}

Call DownloadService as following:

_downloadService.RetrieveTextFromUrl(config, serverAddress, (result, args) =>
{
// Do what you need with the result variable
// result is of string type (in current case)
});
test_123
Joined: Nov 6, 2017
Messages: 17
Offline
Hi Dmitry,

Thank you for your input. Currently I was developed android custom app. Do you have some sample code for android?

Thanks and Regards,

Andi
Dmitry_Shikulin
Joined: Dec 20, 2016
Messages: 58
Offline
Andi,

Unfortunately I don't have code for Android right now.
I will try to find more details ASAP if you still need it.

Regards,
Dmitry
test_123
Joined: Nov 6, 2017
Messages: 17
Offline
Hi Dimirty

Thank you for your attention ,
yes i really need the automatic configuration of the server for my custom app

Thanks and Regards,

Andi
Rumata
Joined: Dec 20, 2016
Messages: 133
Offline
Hi Andi,

you can use following code on Android:

URL url = new URL(sourceURI);
DownloadServiceConfiguration downloadConfiguration = new DownloadServiceConfiguration();
downloadConfiguration.setCredentialProvider(new UserCredentialProvider(username, password));
String applicationDir = "";
try{
applicationDir = App.getContext().getApplicationInfo().dataDir + "/";
}
catch (NullPointerException ex){
clientLogger.log("getApplicationInfo trows null pointer exception. Use empty applicationDir string");
}

DownloadWatcher watcher = service.downloadFile(downloadConfiguration, url, applicationDir + destinationDirectory, new DownloadCompletionHandler<File>() {
@Override
public void onSuccess(File file) {
clientLogger.log("Download file is successful. Filename:" + file.getName());
}

@Override
public void onError(DownloadServiceError error) {
if (error != null) {
clientLogger.log("Download file failed. Reason:" + error.toString());
} else {
clientLogger.log("Null error instance");
}
}

});
test_123
Joined: Nov 6, 2017
Messages: 17
Offline
HI Rumanta

thanks for your attention, the code it's works and I will implement it into the server in my office ..

Thanks and Regards,
Andi
Go to:   
Mobile view