mirror of https://github.com/YTVanced/VancedMicroG
MCS: Fix reconnect
This commit is contained in:
parent
7b3e490d55
commit
39c957cda8
|
@ -86,6 +86,7 @@
|
||||||
<action android:name="com.google.android.location.internal.GoogleLocationManagerService.START" />
|
<action android:name="com.google.android.location.internal.GoogleLocationManagerService.START" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service android:name="org.microg.gms.location.ReportingAndroidService">
|
<service android:name="org.microg.gms.location.ReportingAndroidService">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="com.google.android.location.reporting.service.START" />
|
<action android:name="com.google.android.location.reporting.service.START" />
|
||||||
|
@ -101,10 +102,12 @@
|
||||||
android:name="org.microg.gms.gservices.GServicesProvider"
|
android:name="org.microg.gms.gservices.GServicesProvider"
|
||||||
android:authorities="com.google.android.gsf.gservices"
|
android:authorities="com.google.android.gsf.gservices"
|
||||||
android:exported="true" />
|
android:exported="true" />
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="org.microg.gms.settings.GoogleSettingsProvider"
|
android:name="org.microg.gms.settings.GoogleSettingsProvider"
|
||||||
android:authorities="com.google.settings"
|
android:authorities="com.google.settings"
|
||||||
android:exported="true" />
|
android:exported="true" />
|
||||||
|
|
||||||
<provider
|
<provider
|
||||||
android:name="org.microg.gms.feeds.SubscribedFeedsProvider"
|
android:name="org.microg.gms.feeds.SubscribedFeedsProvider"
|
||||||
android:authorities="subscribedfeeds"
|
android:authorities="subscribedfeeds"
|
||||||
|
@ -151,6 +154,7 @@
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</service>
|
</service>
|
||||||
|
|
||||||
<service
|
<service
|
||||||
android:name="org.microg.gms.gcm.McsService"
|
android:name="org.microg.gms.gcm.McsService"
|
||||||
android:exported="true" />
|
android:exported="true" />
|
||||||
|
@ -159,6 +163,18 @@
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
<action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="org.microg.gms.gcm.RECONNECT" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.PACKAGE_REPLACED" />
|
||||||
|
<data
|
||||||
|
android:scheme="package"
|
||||||
|
android:path="com.google.android.gms" />
|
||||||
|
</intent-filter>
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="android.intent.action.MY_PACKAGE_REPLACED" />
|
||||||
|
</intent-filter>
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.provider.Telephony.SECRET_CODE" />
|
<action android:name="android.provider.Telephony.SECRET_CODE" />
|
||||||
|
|
||||||
|
@ -232,6 +248,7 @@
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="org.microg.gms.auth.login.LoginActivity"
|
android:name="org.microg.gms.auth.login.LoginActivity"
|
||||||
android:configChanges="keyboardHidden|orientation|screenSize"
|
android:configChanges="keyboardHidden|orientation|screenSize"
|
||||||
|
@ -243,6 +260,7 @@
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
android:name="org.microg.gms.auth.AskPermissionActivity"
|
android:name="org.microg.gms.auth.AskPermissionActivity"
|
||||||
android:excludeFromRecents="true"
|
android:excludeFromRecents="true"
|
||||||
|
|
|
@ -20,6 +20,7 @@ import android.app.IntentService;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.SharedPreferences;
|
import android.content.SharedPreferences;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.squareup.wire.Message;
|
import com.squareup.wire.Message;
|
||||||
|
@ -163,6 +164,7 @@ public class McsService extends IntentService {
|
||||||
heartbeatThread = null;
|
heartbeatThread = null;
|
||||||
}
|
}
|
||||||
Log.d(TAG, "Connection closed");
|
Log.d(TAG, "Connection closed");
|
||||||
|
sendBroadcast(new Intent("org.microg.gms.gcm.RECONNECT"), "org.microg.gms.STATUS_BROADCAST");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleClose(Close close) throws IOException {
|
private void handleClose(Close close) throws IOException {
|
||||||
|
@ -170,7 +172,7 @@ public class McsService extends IntentService {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleLoginresponse(LoginResponse loginResponse) throws IOException {
|
private void handleLoginresponse(LoginResponse loginResponse) throws IOException {
|
||||||
getSharedPreferences().edit().putString(PREF_LAST_PERSISTENT_ID, null);
|
getSharedPreferences().edit().putString(PREF_LAST_PERSISTENT_ID, "").apply();
|
||||||
if (loginResponse.error == null) {
|
if (loginResponse.error == null) {
|
||||||
Log.d(TAG, "Logged in");
|
Log.d(TAG, "Logged in");
|
||||||
} else {
|
} else {
|
||||||
|
@ -189,10 +191,8 @@ public class McsService extends IntentService {
|
||||||
|
|
||||||
private void handleMessage(DataMessageStanza message) throws IOException {
|
private void handleMessage(DataMessageStanza message) throws IOException {
|
||||||
if (message.persistent_id != null) {
|
if (message.persistent_id != null) {
|
||||||
String old = getSharedPreferences().getString(PREF_LAST_PERSISTENT_ID, null);
|
String old = getSharedPreferences().getString(PREF_LAST_PERSISTENT_ID, "");
|
||||||
if (old == null) {
|
if (!old.isEmpty()) {
|
||||||
old = "";
|
|
||||||
} else {
|
|
||||||
old += "|";
|
old += "|";
|
||||||
}
|
}
|
||||||
getSharedPreferences().edit()
|
getSharedPreferences().edit()
|
||||||
|
|
Loading…
Reference in New Issue