We're making changes to the Community, so you may have received some notifications - thanks for your patience and welcome back. Learn more here.

Forum Discussion

Siddharth J.'s avatar
Siddharth J.
New member | Level 1
10 years ago

Dropbox com.android.packageinstaller.InstallAppProgress has leaked IntentReceiver

Unable to upload a file.
I am trying to upload a file to dropbox. I have configured manifest file, and written the below code. Please help me understand what I am missing here.

Debug Statements prove that the file is correct.

02-11 12:24:37.835: D/AutoActivate(14797): Database path /data/data/<mypackage>/databases/activations
02-11 12:24:37.835: D/AutoActivate(14797): File path activations.db len 4358144

public class UploadDB2DropBox extends AsyncTask<Object, Void, String> {
    private Context context;
    private WakeLock wakeLock;

    final static private String APP_KEY = "something";
    final static private String APP_SECRET = "sometingmore";
    final static private AccessType ACCESS_TYPE = AccessType.APP_FOLDER;
    private DropboxAPI<AndroidAuthSession> mDBApi;

    public UploadDB2DropBox(Context context) {
        this.context = context;
        AppKeyPair appKeys = new AppKeyPair(APP_KEY, APP_SECRET);
        AndroidAuthSession session = new AndroidAuthSession(appKeys,
                ACCESS_TYPE);
        mDBApi = new DropboxAPI<AndroidAuthSession>(session);
        mDBApi.getSession().startOAuth2Authentication(context);
    }

    protected void onPreExecute() {
        super.onPreExecute();
        final PowerManager pm = (PowerManager) context
                .getSystemService(Context.POWER_SERVICE);
        wakeLock = pm.newWakeLock(PowerManager.FULL_WAKE_LOCK, "");
        wakeLock.acquire();
    }

    @Override
    protected String doInBackground(Object... params) {
        File file = new File(context.getDatabasePath(God.TABLE_ACTIVATIONS)
                + ".db");
        Log.d(God.TAG,
                "Database path "
                        + context.getDatabasePath(God.TABLE_ACTIVATIONS));
        FileInputStream inputStream;
        try {
            inputStream = new FileInputStream(file);

DropboxException_ONE_LINE_BELOW     
            Entry response = mDBApi.putFile(
                    "/" + God.TABLE_ACTIVATIONS + God.getTodayInLong(),
                    inputStream, file.length(), null, null);
            Log.d(God.TAG, "Uploaded file is " + response.rev);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            Log.e(God.TAG, "FileNotFoundException");
        } catch (DropboxException e) {
            e.printStackTrace();
            Log.e(God.TAG, "DropboxException");
        }
        return null;
    }

    protected void onPostExecute(String result) {
        super.onPostExecute(result);
        if (wakeLock.isHeld())
            wakeLock.release();
        God.notifyNewActivations(context);
        if (mDBApi.getSession().authenticationSuccessful()) {
            try {
                // Required to complete auth, sets the access token on the session
                mDBApi.getSession().finishAuthentication();

                String accessToken = mDBApi.getSession().getOAuth2AccessToken();
            } catch (IllegalStateException e) {
                Log.i(God.TAG, "Error authenticating", e);
            }
        }
    }
}

I am getting a exception at DropboxException_ONE_LINE_BELOW. Below is the exception.

com.android.packageinstaller.InstallAppProgress has leaked IntentReceiver com.android.packageinstaller.InstallAppProgress$4@4231a880 that was originally registered here. Are you missing a call to unregisterReceiver()?

02-10 15:04:06.592: E/ActivityThread(26210):    at android.app.LoadedApk$ReceiverDispatcher.<init>(LoadedApk.java:822)
02-10 15:04:06.592: E/ActivityThread(26210):    at android.app.LoadedApk.getReceiverDispatcher(LoadedApk.java:593)
02-10 15:04:06.592: E/ActivityThread(26210):    at android.app.ContextImpl.registerReceiverInternal(ContextImpl.java:1167)
02-10 15:04:06.592: E/ActivityThread(26210):    at android.app.ContextImpl.registerReceiver(ContextImpl.java:1154)
02-10 15:04:06.592: E/ActivityThread(26210):    at android.app.ContextImpl.registerReceiver(ContextImpl.java:1148)
02-10 15:04:06.592: E/ActivityThread(26210):    at android.content.ContextWrapper.registerReceiver(ContextWrapper.java:365)
02-10 15:04:06.592: E/ActivityThread(26210):    at com.android.packageinstaller.InstallAppProgress.initView(InstallAppProgress.java:267)
02-10 15:04:06.592: E/ActivityThread(26210):    at com.android.packageinstaller.InstallAppProgress.onCreate(InstallAppProgress.java:179)
02-10 15:04:06.592: E/ActivityThread(26210):    at android.app.Activity.performCreate(Activity.java:5158)
02-10 15:04:06.592: E/ActivityThread(26210):    at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1080)
02-10 15:04:06.592: E/ActivityThread(26210):    at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2148)
02-10 15:04:06.592: E/ActivityThread(26210):    at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2211)
02-10 15:04:06.592: E/ActivityThread(26210):    at android.app.ActivityThread.access$600(ActivityThread.java:149)
02-10 15:04:06.592: E/ActivityThread(26210):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1300)
02-10 15:04:06.592: E/ActivityThread(26210):    at android.os.Handler.dispatchMessage(Handler.java:99)
02-10 15:04:06.592: E/ActivityThread(26210):    at android.os.Looper.loop(Looper.java:153)
02-10 15:04:06.592: E/ActivityThread(26210):    at android.app.ActivityThread.main(ActivityThread.java:5086)
02-10 15:04:06.592: E/ActivityThread(26210):    at java.lang.reflect.Method.invokeNative(Native Method)
02-10 15:04:06.592: E/ActivityThread(26210):    at java.lang.reflect.Method.invoke(Method.java:511)
02-10 15:04:06.592: E/ActivityThread(26210):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:821)
02-10 15:04:06.592: E/ActivityThread(26210):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
02-10 15:04:06.592: E/ActivityThread(26210):    at dalvik.system.NativeStart.main(Native Method)

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback

Find help with the Dropbox API from other developers.

5,875 PostsLatest Activity: 2 months ago
325 Following

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!