ethanwang / floatingimage

Automatically exported from code.google.com/p/floatingimage
0 stars 1 forks source link

Launching activity on dock/charger intent. #8

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Connect charger/dock (without 'misc->Launch on dock' setting selected).

What is the expected output? What do you see instead?
Expected: Nothing happens

Actual: Activity is launched and immediately killed.

What version of the product are you using? On what operating system?
Floating Image version 3.4.16 running on Android 4.0.4

Please provide any additional information below.
I changed the DockBroadcastReciever's onRecieve to check for the setting before 
it decides if it should launch the activity:

    boolean open = sp.getBoolean("open_on_dock", false);
    if(open) {          
        if(!sp.getBoolean("running", false)){
            i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context.startActivity(i);
        }
    }

Works great with the setting on or off, but ugly as all hell :)

Original issue reported on code.google.com by mfranzo...@gmail.com on 6 Aug 2012 at 3:08