Multi user scenario is quiet tedious and might run into complexities when put in production environment,I have followed some steps to cope up with such complexities and i have listed out stuff which i have followed in the table below So, you have to follow some ground rules here other than doing just unregister,
Using mutiple users in an android SUP app
문제
Is it possible to use mutiple users in an android app based on SUP (Sybase Unwired Plattform 2.1.2)?
I have an android app which is installed on devices (logistics) which are shared by multiple users. When I register a device, it is bound to a single user, but there is no way to bind this device to a new user. app.unregisterApplication()
has no effect.
public void initialize() {
final Application app = getApplication();
if(app.getRegistrationStatus() != RegistrationStatus.REGISTERED) {
app.registerApplication(TIMEOUT);
}else{
app.startConnection(TIMEOUT);
}
...
}
private Application getApplication() {
final Application app = Application.getInstance();
if(! APPLICATION_ID.equals(app.getApplicationIdentifier())) {
app.setApplicationIdentifier(APPLICATION_ID);
}
app.setApplicationContext(LoginActivity.this);
ScannerAnbindungDB.setApplication(app);
ScannerAnbindungDB.getSynchronizationProfile().setServerName(HOST);
ScannerAnbindungDB.getSynchronizationProfile().setAsyncReplay(false);
ScannerAnbindungDB.getSynchronizationProfile().setDomainName(DOMAIN_NAME);
ScannerAnbindungDB.getConnectionProfile().setDomainName(DOMAIN_NAME);
final ConnectionProperties connProps = app.getConnectionProperties();
final LoginCredentials loginCredentials = new LoginCredentials(benutzername.getText().toString(), passwort.getText().toString());
connProps.setLoginCredentials(loginCredentials);
connProps.setServerName(HOST);
connProps.setPortNumber(PORT);
ScannerAnbindungDB.getSynchronizationProfile().save();
ScannerAnbindungDB.getConnectionProfile().save();
return app;
}
Even when it is registered and I use app.startConnection()
the credentials are not checked again.
해결책 2
다른 팁
This was just an android simulator issue :-( With an new emulator instance or a real device app.unregisterApplication()
works fine. My code looks like this right now:
if(app.getRegistrationStatus() == RegistrationStatus.REGISTERED) {
app.unregisterApplication(TIMEOUT);
}
app.registerApplication(TIMEOUT);
This means, that the device is always unregistered when a user logs in.
제휴하지 않습니다 StackOverflow