mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-02-01 19:57:11 +01:00
reregister using GCM id if it's changed (or been received) since last registered
This commit is contained in:
parent
512c080634
commit
7dfc800fcb
1 changed files with 9 additions and 8 deletions
|
@ -654,11 +654,6 @@ public class RelayService extends XWService
|
||||||
DbgUtils.logf( "registerWithRelay: skipping because only %d "
|
DbgUtils.logf( "registerWithRelay: skipping because only %d "
|
||||||
+ "seconds since last start", interval );
|
+ "seconds since last start", interval );
|
||||||
} else {
|
} else {
|
||||||
s_regStartTime = now;
|
|
||||||
|
|
||||||
boolean ackd =
|
|
||||||
XWPrefs.getPrefsBoolean( this, R.string.key_relay_regid_ackd,
|
|
||||||
false );
|
|
||||||
String relayID = XWPrefs.getRelayDevID( this );
|
String relayID = XWPrefs.getRelayDevID( this );
|
||||||
DevIDType[] typa = new DevIDType[1];
|
DevIDType[] typa = new DevIDType[1];
|
||||||
String devid = getDevID( typa );
|
String devid = getDevID( typa );
|
||||||
|
@ -669,8 +664,8 @@ public class RelayService extends XWService
|
||||||
try {
|
try {
|
||||||
DataOutputStream out = new DataOutputStream( bas );
|
DataOutputStream out = new DataOutputStream( bas );
|
||||||
|
|
||||||
writeVLIString( out, relayID ); // may be empty
|
writeVLIString( out, relayID ); // may be empty
|
||||||
if ( ackd && DevIDType.ID_TYPE_RELAY == typ ) { // all's well
|
if ( DevIDType.ID_TYPE_RELAY == typ ) { // all's well
|
||||||
out.writeByte( DevIDType.ID_TYPE_NONE.ordinal() );
|
out.writeByte( DevIDType.ID_TYPE_NONE.ordinal() );
|
||||||
} else {
|
} else {
|
||||||
out.writeByte( typ.ordinal() );
|
out.writeByte( typ.ordinal() );
|
||||||
|
@ -686,6 +681,7 @@ public class RelayService extends XWService
|
||||||
writeVLIString( out, Build.VERSION.RELEASE );
|
writeVLIString( out, Build.VERSION.RELEASE );
|
||||||
|
|
||||||
postPacket( bas, XWRelayReg.XWPDEV_REG );
|
postPacket( bas, XWRelayReg.XWPDEV_REG );
|
||||||
|
s_regStartTime = now;
|
||||||
} catch ( java.io.IOException ioe ) {
|
} catch ( java.io.IOException ioe ) {
|
||||||
DbgUtils.loge( ioe );
|
DbgUtils.loge( ioe );
|
||||||
}
|
}
|
||||||
|
@ -807,8 +803,13 @@ public class RelayService extends XWService
|
||||||
|
|
||||||
private String getDevID( DevIDType[] typp )
|
private String getDevID( DevIDType[] typp )
|
||||||
{
|
{
|
||||||
|
String devid = null;
|
||||||
DevIDType typ;
|
DevIDType typ;
|
||||||
String devid = XWPrefs.getRelayDevID( this );
|
|
||||||
|
if ( XWPrefs.getPrefsBoolean( this, R.string.key_relay_regid_ackd,
|
||||||
|
false ) ) {
|
||||||
|
devid = XWPrefs.getRelayDevID( this );
|
||||||
|
}
|
||||||
if ( null != devid && 0 < devid.length() ) {
|
if ( null != devid && 0 < devid.length() ) {
|
||||||
typ = DevIDType.ID_TYPE_RELAY;
|
typ = DevIDType.ID_TYPE_RELAY;
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue