CN103577554B - Trigger the method and device of Android device multimedia database scanning - Google Patents

Trigger the method and device of Android device multimedia database scanning Download PDF

Info

Publication number
CN103577554B
CN103577554B CN201310491783.3A CN201310491783A CN103577554B CN 103577554 B CN103577554 B CN 103577554B CN 201310491783 A CN201310491783 A CN 201310491783A CN 103577554 B CN103577554 B CN 103577554B
Authority
CN
China
Prior art keywords
scanning
file
path
backstage
multimedia
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201310491783.3A
Other languages
Chinese (zh)
Other versions
CN103577554A (en
Inventor
惠涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangdong Oppo Mobile Telecommunications Corp Ltd
Original Assignee
Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Oppo Mobile Telecommunications Corp Ltd filed Critical Guangdong Oppo Mobile Telecommunications Corp Ltd
Priority to CN201310491783.3A priority Critical patent/CN103577554B/en
Publication of CN103577554A publication Critical patent/CN103577554A/en
Application granted granted Critical
Publication of CN103577554B publication Critical patent/CN103577554B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/14Details of searching files based on file metadata
    • G06F16/148File search processing

Abstract

The invention discloses a kind of method and device for triggering the scanning of Android device multimedia database, methods described includes creating a scanning client Similar integral multi-medium data library inquiry service class;Create a scanning class instantiation scanning client class;Write a scan service backstage;Change adbpush orders;Android device is copied files to by adb push orders;When push file data is completed, the path of file is obtained;When the path for judging file is legal, file path parameter is issued into scan service backstage, and start scan service backstage;According to file path parameter, the path of scanning is set by scanning client class;According to scanning pattern, scanning client class is set to be connected with backstage multimedia service foundation by scanning class, triggered multimedia scan database.The present invention, which can avoid obtaining data every time, needs scan full hard disk, so as to cause the problem of system resource is nervous.

Description

Trigger the method and device of Android device multimedia database scanning
Technical field
The present invention relates to a kind of method of triggered multimedia scan database, especially a kind of triggering Android device is more The method and device of media database scanning.Belong to mobile device technology field.
Background technology
Current Android device, by taking mobile phone as an example, various mobile phone assistance applications are a lot, such as 91 assistants, pea pods, 360 Mobile phone assistant, Tengxun mobile phone assistant etc.;These mobile phones assistant can operate to mobile phone file system, be essentially all logical Cross pc adb(Android Debug Bridge)Client, sets up with mobile phone adb servers and is connected, by obtaining mobile phone file System directory, uses adb orders(Push, pull etc.), upload down operation is carried out to file;When user is helped by pc ends mobile phone Hand, by some file push into mobile phone, many files in cellphone directory.But similar photograph album, the application such as music, video is but Do not find that new file is copied into mobile phone timely, because these applications all rely on Android multimedia database (The database saves the fileinfo used in T cards and mobile phone), but multimedia database only can be in start, usb storage moulds Just meeting active adversary machine storage is scanned during formula switching, and when mobile phone assistant is by adb push orders, copy new file is in one's hands During machine, multimedia database is not scanned, therefore, and file is not updated in database, cause user can not and When use file, bring puzzlement to a certain extent to user, and the main method for solving this problem at present is exactly to mobile phone Storage and T cards carry out scan full hard disk, so that multimedia database is updated, but this method not only takes but also wastes system resource, shadow The use of mobile phone is rung.
Chinese Patent Application No. is 201110221093.7 application for a patent for invention, discloses " a kind of to be based on android systems The scan method of the multimedia file of the storage device of system ", its technical characterstic is that scanning process is divided into two stages, first First by document classification to be scanned in stage, the corresponding information updating of each class is obtained respectively into database, and sets up corresponding The information that file directory, wherein picture file and video file are added to database only includes file name and path, without Metdata information is added, the time required for scanning is greatlyd save;Built file directory is supplied to user with breviary diagram form, Whether user is file to be scanned by thumbnail identification, confirms as carrying out checking that just obtaining metdata believes after file to be scanned Breath, the problem of solving prior art scanning process duration, there is the wasting of resources, therefore, what the application for a patent for invention was emphasized It is the realization of scanning process, the technical inspiration of not timely triggered multimedia scan database.
The content of the invention
The invention aims to the defect for solving above-mentioned prior art, there is provided one kind triggering many matchmakers of Android device The method of volume data storehouse scanning, this method can upgrade in time multimedia database, it is to avoid obtain every time data need to carry out it is complete Sweeping is retouched, so that cause system resource nervous, the problem of influence application is used.
Another object of the present invention is to provide a kind of device for triggering the scanning of Android device multimedia database.
The purpose of the present invention can be reached by adopting the following technical scheme that:
The method for triggering the scanning of Android device multimedia database, it is characterised in that:Methods described includes:
1)Create class, write backstage and modification order
1.1)The multimedia database for creating a scanning client class ScannerClient succession Android device is looked into Ask service class MediaScannerConnectionClient;
1.2)Create a scanning class ScanFile instantiations ScannerClient;
1.3)A scan service backstage FileScanService is write, makes the backstage on startup, according to the road of file Footpath parameter, passes through ScanFile triggered multimedia scan databases;
1.4)Adb push orders are changed, makes the path of file when legal, the path parameter of file is sent to FileScanService;
2)Triggered multimedia scan database
2.1)Android device is copied files to by adb push orders;
2.2)When push file data is completed, file is obtained in the path of Android device;
2.3)When the path for judging file is legal, the path parameter of file is issued into FileScanService, and start FileScanService;
2.4)According to FileScanService file path parameter, the road of scanning is set by ScannerClient Footpath;
2.5)According to the scanning pattern of setting, the backstage of ScannerClient and Android device is made by ScanFile Multimedia service sets up connection, triggered multimedia scan database;
2.6)After the completion of scanning, the backstage multimedia service of ScannerClient and Android device, which disconnects, to be connected Connect.
It is preferred that, step 1.1)Described one scanning client class ScannerClient of establishment, including:
Define a method onMediaScannerConnected, the backstage multimedia service with Android device Set up connection;
A method onScanCompleted is defined, is disconnected with the backstage multimedia service of Android device;
A method setScanPath is defined, to set the path of scanning.
It is preferred that, step 1.2)Described one scanning class ScanFile of establishment, including:
A method beginScanFile is defined, with triggered multimedia scan database.
Another object of the present invention can be reached by adopting the following technical scheme that:
Trigger the device of Android device multimedia database scanning, it is characterised in that:Described device includes:
Client class creation module is scanned, Android is inherited for creating a scanning client class ScannerClient The multi-medium data library inquiry service class MediaScannerConnectionClient of equipment;
Class creation module is scanned, for creating a scanning class ScanFile instantiations ScannerClient;
Module is write on scan service backstage, for writing a scan service backstage FileScanService, makes the backstage On startup, according to the path parameter of file, ScanFile triggered multimedia scan databases are passed through;
Order modified module, for changing adb push orders, makes the path of file when legal, the path of file is joined Number is sent to FileScanService;
File copy module, for copying files to Android device by adb push orders;
Path acquisition module, for when push file data completion, obtaining file in the path of Android device;
Path parameter sending module, for when the path for judging file is legal, the path parameter of file to be issued FileScanService, and start FileScanService;
Scanning pattern setup module, for the path parameter according to file, the road of scanning is set by ScannerClient Footpath;
Multimedia database scans trigger module, for the scanning pattern according to setting, is made by ScanFile The ScannerClient and backstage multimedia service of Android device, which is set up, to be connected, triggered multimedia scan database;
Connection disconnects module, for after the completion of scanning, the backstage multimedia of ScannerClient and Android device Service is disconnected.
It is preferred that, the scanning client class creation module includes:
First definition unit, for defining a method onMediaScannerConnected, with Android device Backstage multimedia service sets up connection;
Second definition unit, for defining a method onScanCompleted, many matchmakers in backstage with Android device Body service is disconnected;
3rd definition unit, for defining a method setScanPath, to set the path of scanning.
It is preferred that, the scanning class creation module includes:
4th definition unit, for defining a method beginScanFile, with triggered multimedia scan database
The present invention has following beneficial effect relative to prior art:
The inventive method and device, the adb orders of new class and modification by creating, can in time and accurately obtain base In the application of development of Multimedia Databases(Photograph album, video, music)Latest data, it is to avoid prior art copied files multimedia Database can not be updated, and data are obtained every time to be needed to carry out scan full hard disk, so as to cause system resource nervous, influence application is used The problem of.
Brief description of the drawings
Fig. 1 triggers the establishment class of Android device multimedia database scan method for the present invention, writes backstage and repair Change the schematic flow sheet of order.
Fig. 2 triggers the triggered multimedia scan database of Android device multimedia database scan method for the present invention Schematic flow sheet.
The apparatus structure block diagram that Fig. 3 scans for the triggering Android device multimedia database of the present invention.
Embodiment
Embodiment 1:
The method of the triggering Android device multimedia database scanning of the present embodiment, including:
1)Create class, backstage write and modification order, as shown in figure 1, specific as follows:
1.1)The multimedia database for creating a scanning client class ScannerClient succession Android device is looked into Service class MediaScannerConnectionClient is ask, it is specific as follows:
Wherein, method onMediaScannerConnected is used for the backstage multimedia service with Android device Set up connection;Method onScanCompleted is used to disconnect with the backstage multimedia service of Android device;Method SetScanPath is used for the path for setting scanning;
1.2)Create a scanning class ScanFile and instantiate ScannerClient, it is specific as follows:
Wherein, beginScanFile methods are used for triggered multimedia scan database.
1.3)A scan service backstage FileScanService is write, makes the backstage on startup, according to the road of file Footpath parameter, passes through ScanFile triggered multimedia scan databases;
1.4)Adb push orders are changed, makes the path of file when legal, the path parameter of file is sent to FileScanService, it is as follows:
If (being push orders)
if(Whether help information is shown)Help information is shown, and returns to 1;
if(Whether push data are completed){
The Android device path of file is obtained, judges whether path is legal, it is illegal to return to 1;
Path is legal, and path is sent into FileScanService, starts multimedia database scanning }
}
2)Triggered multimedia scan database, as shown in Fig. 2 specific as follows:
2.1)Android device is copied files to by adb push orders;
2.2)When push file data is completed, file is obtained in the path of Android device;
2.3)When the path for judging file is legal, the path parameter of file is issued into FileScanService, and start FileScanService;
2.4)According to FileScanService file path parameter, the road of scanning is set by ScannerClient Footpath;
2.5)According to the scanning pattern of setting, the backstage of ScannerClient and Android device is made by ScanFile Multimedia service sets up connection, calls ScanFile.beginScanFile () method scanning file, triggered multimedia number Scanned according to storehouse;
2.6)After the completion of scanning, the backstage multimedia service of ScannerClient and Android device, which disconnects, to be connected Connect.
As shown in figure 3, the device of the corresponding triggering Android device multimedia database scanning of the present embodiment, including sweep Retouch client class creation module, scanning class creation module, scan service backstage and write module, order modified module, file transmission Module, path acquisition module, path parameter sending module, scanning pattern setup module, multimedia database scanning trigger module And connection disconnects module, wherein:
The scanning client class creation module, is inherited for creating a scanning client class ScannerClient The multi-medium data library inquiry service class MediaScannerConnectionClient of Android device, including:
First definition unit, for defining a method onMediaScannerConnected, with Android device Backstage multimedia service sets up connection;
Second definition unit, for defining a method onScanCompleted, many matchmakers in backstage with Android device Body service is disconnected;
3rd definition unit, for defining a method setScanPath, to set the path of scanning;
The scanning class creation module, for creating a scanning class ScanFile instantiation ScannerClient, bag Include:
4th definition unit, for defining a method beginScanFile, with triggered multimedia scan database.
Module is write on the scan service backstage, for writing a scan service backstage FileScanService, makes this Backstage on startup, according to the path parameter of file, passes through ScanFile triggered multimedia scan databases;
The order modified module, for changing adb push orders, makes the path of file when legal, by the road of file Footpath parameter is sent to FileScanService;
The file copy module, for copying files to Android device by adb push orders;
The path acquisition module, for when push file data completion, obtaining file on the road of Android device Footpath;
The path parameter sending module, for when the path for judging file is legal, the path parameter of file to be issued FileScanService, and start FileScanService;
The scanning pattern setup module, for the path parameter according to file, is set by ScannerClient and scanned Path;
The multimedia database scans trigger module, for the scanning pattern according to setting, is made by ScanFile The ScannerClient and backstage multimedia service of Android device, which is set up, to be connected, triggered multimedia scan database;
The connection disconnects module, for after the completion of scanning, the backstage of ScannerClient and Android device to be more Media service is disconnected.
Android device described in the present embodiment can be using the mobile phone of android system, e-book, PDA, people Machine interactive terminal or other there is the hand held terminal unit of display function.
In addition, one of ordinary skill in the art will appreciate that realizing all or part of step in the various embodiments described above method It can be by program to instruct the hardware of correlation to complete, corresponding program can be stored in embodied on computer readable storage Jie In matter, described storage medium, such as ROM/RAM, disk or CD.
It is described above, it is only patent preferred embodiment of the present invention, but the protection domain of patent of the present invention is not limited to This, any one skilled in the art is in the scope disclosed in patent of the present invention, according to the skill of patent of the present invention Art scheme and its patent of invention design are subject to equivalent substitution or change, belong to the protection domain of patent of the present invention.

Claims (2)

1. trigger the method for Android device multimedia database scanning, it is characterised in that:Methods described includes:
1) create class, write backstage and modification order
1.1) the multi-medium data library inquiry clothes that a scanning client class ScannerClient inherits Android device are created Class of being engaged in MediaScannerConnectionClient;
Described one scanning client class ScannerClient of establishment, including:
A method onMediaScannerConnected is defined, is set up with the backstage multimedia service of Android device Connection;
A method onScanCompleted is defined, is disconnected with the backstage multimedia service of Android device;
A method setScanPath is defined, to set the path of scanning;
1.2) a scanning class ScanFile instantiations ScannerClient is created;
Described one scanning class ScanFile of establishment, including:
A method beginScanFile is defined, with triggered multimedia scan database;
1.3) a scan service backstage FileScanService is write, makes the backstage on startup, is joined according to the path of file Number, passes through ScanFile triggered multimedia scan databases;
1.4) adb push orders are changed, makes the path of file when legal, the path parameter of file is sent to FileScanService;
2) triggered multimedia scan database
2.1) Android device is copied files to by adb push orders;
2.2) when push file data is completed, file is obtained in the path of Android device;
2.3) when the path for judging file is legal, the path parameter of file is issued into FileScanService, and start FileScanService;
2.4) according to FileScanService file path parameter, the path of scanning is set by ScannerClient;
2.5) according to the scanning pattern of setting, many matchmakers in the backstage of ScannerClient and Android device are made by ScanFile Body service sets up connection, triggered multimedia scan database;
2.6) after the completion of scanning, the backstage multimedia service of ScannerClient and Android device is disconnected.
2. trigger the device of Android device multimedia database scanning, it is characterised in that:Described device includes:
Client class creation module is scanned, Android device is inherited for creating a scanning client class ScannerClient Multi-medium data library inquiry service class MediaScannerConnectionClient;
The scanning client class creation module includes:
First definition unit, for defining a method onMediaScannerConnected, the backstage with Android device Multimedia service sets up connection;
Second definition unit, for defining a method onScanCompleted, the backstage multimedia with Android device Service is disconnected;
3rd definition unit, for defining a method setScanPath, to set the path of scanning;
Class creation module is scanned, for creating a scanning class ScanFile instantiations ScannerClient;
The scanning class creation module includes:
4th definition unit, for defining a method beginScanFile, with triggered multimedia scan database;
Module is write on scan service backstage, for writing a scan service backstage FileScanService, is opening the backstage When dynamic, according to the path parameter of file, pass through ScanFile triggered multimedia scan databases;
Order modified module, for changing adb push orders, makes the path of file when legal, the path parameter of file is sent out Give FileScanService;
File copy module, for copying files to Android device by adb push orders;
Path acquisition module, for when push file data completion, obtaining file in the path of Android device;
Path parameter sending module, for when the path for judging file is legal, the path parameter of file to be issued FileScanService, and start FileScanService;
Scanning pattern setup module, for the path parameter according to file, the path of scanning is set by ScannerClient;
Multimedia database scans trigger module, for the scanning pattern according to setting, is made by ScanFile The ScannerClient and backstage multimedia service of Android device, which is set up, to be connected, triggered multimedia scan database;
Connection disconnects module, for after the completion of scanning, the backstage multimedia of ScannerClient and Android device Service is disconnected.
CN201310491783.3A 2013-10-19 2013-10-19 Trigger the method and device of Android device multimedia database scanning Active CN103577554B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201310491783.3A CN103577554B (en) 2013-10-19 2013-10-19 Trigger the method and device of Android device multimedia database scanning

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201310491783.3A CN103577554B (en) 2013-10-19 2013-10-19 Trigger the method and device of Android device multimedia database scanning

Publications (2)

Publication Number Publication Date
CN103577554A CN103577554A (en) 2014-02-12
CN103577554B true CN103577554B (en) 2017-09-29

Family

ID=50049330

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201310491783.3A Active CN103577554B (en) 2013-10-19 2013-10-19 Trigger the method and device of Android device multimedia database scanning

Country Status (1)

Country Link
CN (1) CN103577554B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103970836A (en) * 2014-04-13 2014-08-06 数源科技股份有限公司 Method for accelerating multimedia scanning process in Android
CN105391832A (en) * 2015-11-24 2016-03-09 湖北大学 Hardware information detection system used for detecting hardware state of smartphone
CN105868135A (en) * 2015-12-15 2016-08-17 乐视致新电子科技(天津)有限公司 Method and system for stopping media scanner after USB device ejection in Android system
CN105868143A (en) * 2015-12-15 2016-08-17 乐视致新电子科技(天津)有限公司 Method and system for stopping media scanner after USB device ejection in Android system
CN106502808B (en) * 2016-10-28 2019-10-15 Oppo广东移动通信有限公司 A kind of method, apparatus and terminal of copied files
CN107451475A (en) * 2017-06-15 2017-12-08 努比亚技术有限公司 Multimedia file scan method and equipment, computer-readable recording medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102289484A (en) * 2011-08-03 2011-12-21 Tcl集团股份有限公司 Method for scanning multimedia files of storage equipment based on android system
CN102289481A (en) * 2011-08-02 2011-12-21 Tcl集团股份有限公司 Method and device for acquiring media information of media files in peripheral equipment, and multimedia equipment
CN103246483A (en) * 2013-04-24 2013-08-14 Tcl集团股份有限公司 Method, system and intelligent terminal for scanning files

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102289481A (en) * 2011-08-02 2011-12-21 Tcl集团股份有限公司 Method and device for acquiring media information of media files in peripheral equipment, and multimedia equipment
CN102289484A (en) * 2011-08-03 2011-12-21 Tcl集团股份有限公司 Method for scanning multimedia files of storage equipment based on android system
CN103246483A (en) * 2013-04-24 2013-08-14 Tcl集团股份有限公司 Method, system and intelligent terminal for scanning files

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
MediaScannerConnection;android developers;《Android SDK文档》;20120316;全文 *

Also Published As

Publication number Publication date
CN103577554A (en) 2014-02-12

Similar Documents

Publication Publication Date Title
CN103577554B (en) Trigger the method and device of Android device multimedia database scanning
CN103473277B (en) The Snapshot Method and device of file system
CN102289484B (en) Method for scanning multimedia files of storage equipment based on android system
CN102360410B (en) User operation discovery method of file system and synchronous system utilizing the same
CN101160903B (en) Method, system, client terminal and server for implementing data synchronization
CN103793298A (en) Method for reading Android mobile phone information
CN106445663A (en) Application data migration method and device
CN103838484A (en) Method for deleting redundancy images, and electronic device
CN106708565A (en) Method and device for removing useless picture resources in APK (Android Package)
CN103051652B (en) A kind of mobile terminal cloud computing distribution platform
CN103473065A (en) Virtual machine creation method capable of rapidly restoring system disk
CN101702158A (en) Index file creation synchronized method and search system
CN103064738A (en) Method and system for embedding local application program window into browser in Linux
CN105787091A (en) Content publishing system and method supporting multiple terminals
CN105100195A (en) Data transmission method and device thereof
CN108536467A (en) Location processing method, device, terminal device and the storage medium of code
CN104918112A (en) Camera resource application method and device
CN102917056A (en) Mobile learning system and using method thereof
CN106371706A (en) Method and device for site selection of application shortcuts
CN103246729A (en) Method and system for processing multi-media files of android mobile terminal
CN105786925A (en) Reference model based dynamic data modeling method and apparatus
CN104063475A (en) User-defined list processing method and device
CN102655512A (en) Mobile equipment-based downloading method and system
CN103136264B (en) Attachment query method and user terminal
CN104021215B (en) Picture sorting method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP01 Change in the name or title of a patent holder

Address after: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Patentee after: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP., Ltd.

Address before: Changan town in Guangdong province Dongguan 523860 usha Beach Road No. 18

Patentee before: GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP., Ltd.

CP01 Change in the name or title of a patent holder