Dropbox Core API for Android: Not returning after Authentication -


i developing 2 android applications:

  • the first normal application launcher , on
  • the other application viewer activity (see manifest):

    <activity     android:name=".myactivity"     android:icon="@drawable/icon"     android:label="@string/dropbox" >     <intent-filter>         <action android:name="android.intent.action.view" />         <category android:name="android.intent.category.default" />     </intent-filter> </activity> <activity     android:name="com.dropbox.client2.android.authactivity"     android:configchanges="orientation|keyboard"     android:launchmode="singletask" >     <intent-filter>         <data android:scheme="db-xxxxx" />          <action android:name="android.intent.action.view" />          <category android:name="android.intent.category.browsable" />         <category android:name="android.intent.category.default" />     </intent-filter> </activity> 

the plan is, first application not need internet permissions , second kind of add-on first.

the second application should sync file dropbox (with core api, not sync api).

from first app, start 'myactivity' second app this:

    intent intent = new intent(intent.action_view);     intent.setcomponent(new componentname("my.package","my.package.myactivity"));     intent.putextra("filepath", "/myfile.txt");     startactivityforresult(intent, sync_request); 

that works. activity comes , there, if not authorized yet, user must press button. following code executed

    androidauthsession session = buildsession();     mapi = new dropboxapi<androidauthsession>(session);      mapi.getsession().startauthentication(myactivity.this); 

if user not have dropbox installed, browser pop up.

now troubles begin:

as user presses 'accept' or 'decline', browser not disappear. stays open , myactivity not resumed (onresume not called!).

i found out, adding

    intent.addflags(intent.flag_activity_new_task); 

before starting myactivity first application solve problem, can not listen/wait result of myactivity.

i frustrated. can me or give me advise?

thanks!

when using startauthentication method. automatically start authactivity. not need call startactivity() explicitly. in onresume method of activity write code :

@override     protected void onresume()     {         super.onresume();         if (if dropboxapi!= null && dropboxapi.getsession().authenticationsuccessful())         {             try {                  dropboxapi.getsession().finishauthentication();                 oauth2token = dropboxapi.getsession().getoauth2accesstoken();             }             catch (illegalstateexception ie)             {                 ie.printstacktrace();             }         }      } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -