Task : when turning on the application, check the validity of the VKAccessToken received in the previous session.
Problem : The method that listens for AccessToken'a changes does not work.
After authorizing a user, I receive the VKAccessToken , via onActivityResult and save it in Preferences . But, when the application is turned on, I need to somehow find out its validity (which will guarantee that the user has not changed the password or something else).
For the "wiretapping" of validity changes - I launch the VKAccessTokenTracker listener, as written in VK Api:
public class Application extends android.app.Application { private static final String TAG = "RostislavLOG"; //Временная переменная для откладки private VKAccessTokenTracker vkAccessTokenTracker = new VKAccessTokenTracker() { @Override public void onVKAccessTokenChanged(VKAccessToken oldToken, VKAccessToken newToken) { if (newToken == null) { Log.i(TAG, "VKAccessToken is invalid"); } else { Log.i(TAG, "VKAccessToken is valid"); } } }; @Override public void onCreate() { super.onCreate(); //Инициализация VK Api VKSdk.initialize(this); vkAccessTokenTracker.startTracking(); } } However, the onVKAccessTokenChanged method onVKAccessTokenChanged not start when the application is turned on, and does not react in any way to changing the password (both the included application and the one just launched).
So how does one know the validity of VKAccessToken ?
isLoggined? - user189127VKSdk.isLoggedIn()- Yuriy SPb ♦true, but when I changed the password, it was alsotrue. The methods are interrelated, apparently. - user189127