简体   繁体   中英

Start activity with MEDIA_SCANNER_SCAN_FILE

I want to start an activity when screenshot taken, for this i use MEDIA_SCANNER_SCAN_FILE in my android manifest.

<activity android:name=".ScreenshotActivity">
        <intent-filter>
            <action android:name="android.intent.action.MEDIA_SCANNER_SCAN_FILE" />
            <data android:path="/sdcard/pictures/screenshots"
                android:host="localhost"
                android:scheme="file" />
        </intent-filter>
    </activity>

This dosent't work.

Thanks

ACTION_MEDIA_SCANNER_SCAN_FILE is a broadcast action . The system does not use it to start an activity. Hence, the screenshot-taking functionality will not launch your activity.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM