on 04-27-2012 7:15 PM
Hi Guys,
I myself faced a lot of problems while registering a user using the relay server for android 2.1.2 but could not find any solution to it. After doing a lots of R n D and browsing through a lot of documents i finally found a solution.
Firstly you can register a relay server using the sybase hosted relay server. please refer the following document for steps for setting up a relay server
http://blogs.sybase.com/phoran/?p=491
Once you complete this then in the SCC register a user and give a activation code. Follow the steps for registering the user as mentioned in the above blog.
Here is the code snippet for registering using the relay server
package <package name>;
import com.sybase.collections.GenericList;
import com.sybase.mobile.Application;
import com.sybase.mobile.ConnectionProperties;
import com.sybase.mobile.RegistrationStatus;
import com.sybase.persistence.DefaultCallbackHandler;
import com.sybase.persistence.LoginCredentials;
import com.sybase.persistence.SynchronizationAction;
import com.sybase.persistence.SynchronizationContext;
import com.sybase.persistence.SynchronizationGroup;
import com.sybase.persistence.SynchronizationStatus;
import SUP101.SUP101DB;
import android.app.Activity;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.*;
import android.widget.*;
import android.widget.AdapterView.OnItemClickListener;
public class MainActivity extends Activity
{
private static String HOST = "relayserver.sybase.com";
private static int PORT = 80;
private static String REGNAME;
private static String ACTIVATION_CODE;
private static String FarmId="FarmID";
private static int TIMEOUT = 600;
EditText mregname,mactcode;
int i=0;
Application app=Application.getInstance();
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mregname=(EditText)findViewById(R.id.regname);
mactcode=(EditText)findViewById(R.id.act_code);
Button login=(Button)findViewById(R.id.login);
login.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
REGNAME=mregname.getText().toString();
ACTIVATION_CODE=mactcode.getText().toString();
initializeApplication();
i=app.getRegistrationStatus();
Log.d("Registration status","Value is" +i);
if(app.getRegistrationStatus()==203)
{
Toast.makeText(getBaseContext(),"Success",Toast.LENGTH_SHORT).show();
}
}
});
}
private void initializeApplication()
{
Application app = Application.getInstance();
app.setApplicationIdentifier("SUP101");
app.setApplicationContext(MainActivity.this);
ConnectionProperties connProps = app.getConnectionProperties();
LoginCredentials loginCredentials = new LoginCredentials(REGNAME,ACTIVATION_CODE);
connProps.setLoginCredentials(loginCredentials);
connProps.setServerName(HOST);
connProps.setPortNumber(PORT);
connProps.setFarmId(FarmId);
connProps.setActivationCode(ACTIVATION_CODE);
SUP101DB.setApplication(app);
if (app.getRegistrationStatus() != RegistrationStatus.REGISTERED)
{
app.registerApplication(TIMEOUT);
}
else
{
app.startConnection(TIMEOUT);
}
}
}
Hope this thing helpss
Dear Midhun & Rakshit,
Follow the above document is it needful answer for above requirement.
Thanks,
Syam.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks alot bro.
I have a quick question. Other than this this is there any connection scenarios to connect to SUP
once the sup project is deployed in the unwired server.
If you don't mind can you please share you email id. I am android developer working in enterprise mobility app.
Regards
Midhun
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Midhun
If you would like read more about it please refer to my blog post http://scn.sap.com/community/mobile/blog/2012/05/02/sup-212-native-android-mbo-non-doe-based-approac...
It will give you a clear picture
I hope that will provide some more helpful knowledge.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.