TelegramMessenger / TGPassportAndroidSDK

MIT License
68 stars 27 forks source link

Returned Intent at onActivityResult become null #1

Closed maplerichie closed 6 years ago

maplerichie commented 6 years ago
private static final int TG_PASSPORT_RESULT = 352;

public void onActivityResult(final Activity activity, final int requestCode, final int resultCode, final Intent intent) {
      if (requestCode == TG_PASSPORT_RESULT) {
          if (resultCode == Activity.RESULT_CANCELED) {
            Log.e(E_CANCELLED, "Was cancelled");
          } else if (resultCode == Activity.RESULT_OK) {
            try {
              Uri uri = intent.getData();
              if (uri == null) {
                Log.e(E_NO_DATA_FOUND, "No data found");
              } else {
                Log.e('Success', uri.toString());
              }
            } catch (Exception e) {
              Log.e("TGG", e.toString());
            }
          }
      }
    }

public void initializePassport(int botID, String publicKey, String scope) {
    String scopeArray[] = scope.split("\\|");
    authRequest = new AuthRequest();
    authRequest.botID = botID;
    authRequest.publicKey = publicKey;
    authRequest.payload = payload;
    authRequest.scope = Arrays.asList(scopeArray); //Arrays.asList();
}

public void requestPassport() {
TelegramPassport.request(getCurrentActivity(), authRequest, TG_PASSPORT_RESULT);
}
    buildToolsVersion = "27.0.0"
    minSdkVersion = 16
    compileSdkVersion = 27
    targetSdkVersion = 27
    supportLibVersion = "27.0.0"

intent.getData() = null?

grishka commented 6 years ago

It is null because it is supposed to be. Please read the docs and examples.

maplerichie commented 6 years ago
Currently, the only meaningful parameter is resultCode, which is RESULT_OK if the authorization was successful and RESULT_CANCELED otherwise.

Haha, now only understand this sentence

JalolBieber commented 4 years ago

BUT, If we cannot get any Data from Telegram , what is the USE OF IT ?

BakaryNdiaye commented 2 years ago

👎 ,so If we can't get data from telegram what is the use of it ?