ThanksThis means that the activity was not running when the event was raised. The event will be executed when the activity resumes.
You can use a service instead. Services are not paused like activities (and are easier to work with).
DropboxManager.Initialize(key, secret, "dropboxmanager")
...
DropboxManager.LinkAccount
....
** Activity (menu) Resume **
** Activity (menu) Pause, UserClosed = false **
** Activity (utilities) Create, isFirst = true **
** Activity (utilities) Resume **
** Service (mlbbackupdbx) Create **
** Service (mlbbackupdbx) Start **
mlbbackupdbx_backupdb_dropbox (java line: 193)
java.lang.RuntimeException: java.lang.NullPointerException
at anywheresoftware.b4a.dropbox.DbxAccountManagerWrapper.LinkAccount(DbxAccountManagerWrapper.java:91)
at bloomob.mylifebook.mlbbackupdbx._backupdb_dropbox(mlbbackupdbx.java:193)
at bloomob.mylifebook.mlbbackupdbx._service_start(mlbbackupdbx.java:273)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:154)
at bloomob.mylifebook.mlbbackupdbx.handleStart(mlbbackupdbx.java:68)
at bloomob.mylifebook.mlbbackupdbx.onStartCommand(mlbbackupdbx.java:53)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2060)
at android.app.ActivityThread.access$2800(ActivityThread.java:124)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1011)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3717)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at anywheresoftware.b4a.dropbox.DbxAccountManagerWrapper.LinkAccount(DbxAccountManagerWrapper.java:89)
... 19 more
java.lang.RuntimeException: Unable to start service bloomob.mylifebook.mlbbackupdbx@4050b1e8 with Intent { cmp=bloomob.mylifebook/.mlbbackupdbx }: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2073)
at android.app.ActivityThread.access$2800(ActivityThread.java:124)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1011)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3717)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:864)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:622)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: java.lang.NullPointerException
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:196)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:154)
at bloomob.mylifebook.mlbbackupdbx.handleStart(mlbbackupdbx.java:68)
at bloomob.mylifebook.mlbbackupdbx.onStartCommand(mlbbackupdbx.java:53)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2060)
... 10 more
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at anywheresoftware.b4a.dropbox.DbxAccountManagerWrapper.LinkAccount(DbxAccountManagerWrapper.java:91)
at bloomob.mylifebook.mlbbackupdbx._backupdb_dropbox(mlbbackupdbx.java:193)
at bloomob.mylifebook.mlbbackupdbx._service_start(mlbbackupdbx.java:273)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:170)
... 14 more
Caused by: java.lang.NullPointerException
at anywheresoftware.b4a.dropbox.DbxAccountManagerWrapper.LinkAccount(DbxAccountManagerWrapper.java:89)
... 19 more
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (menu) Create, isFirst = true **
Thanks. But this means that I should unlink also at FirstTime, before initialize and link account? if I try to just initialize and link, I don't get success when calling Manager_AccountReady.See the example code in post #1. You should initialize Manager when FirstTime is True and only link it once.
You should initialize it once when FirstTime is True.
Do you want to link the account immediately when your app starts?
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
manager.Initialize("xxx", "yyy", "manager")
manager.LinkAccount
End If
Activity.LoadLayout("1")
End Sub
Please use [ code ] [ /code ] tags (without spaces) when posting code.
I tried this code and it worked fine:
B4X:Sub Activity_Create(FirstTime As Boolean) If FirstTime Then manager.Initialize("xxx", "yyy", "manager") manager.LinkAccount End If Activity.LoadLayout("1") End Sub
Which error do you get when you don't call UnlinkAccount?
According to Dropbox documentation the user should only need to approve the link once.
No need to be angry... There is a link to the wrapper at the bottom of the first post.how do I choose Sync API?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?