关于java:zxing条码扫描器的android manifest文件需要添加什么?

What needs to be added to the android manifest file for the zxing barcode scanner?

我已经使用 Intent 将 zxing 条形码扫描仪集成到我的应用程序中,但我不知道清单中需要包含什么。截至目前,当我单击按钮启动相机时,它会导致强制关闭,当我单击强制关闭时,条形码扫描仪会在后面打开并工作。链接到按钮的代码如下:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
    public void onClick(View v) {
    Intent intent = new Intent("com.google.zxing.client.android.SCAN");
    intent.setPackage("com.google.zxing.client.android");
    intent.putExtra("SCAN_MODE","QR_CODE_MODE");
    startActivityForResult(intent, 0);    
    }
public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if (requestCode == 0) {        
        if (resultCode == RESULT_OK) {
            contents = intent.getStringExtra("SCAN_RESULT");
            format = intent.getStringExtra("SCAN_RESULT_FORMAT");
            // Handle successful scan        
            } else if (resultCode == RESULT_CANCELED) {
                // Handle cancel          
            }
        }
}

这是安卓清单文件:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="andrew.markley.android.firstGame"
      android:versionCode="1"
      android:versionName="1.0">
    <uses-sdk android:minSdkVersion="8" />
    <uses-feature android:name="android.hardware.CAMERA"/>
   
       
            <intent-filter>
               
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
            <intent-filter>
               
                <category android:name="com.google.zxing.client.android" />
            </intent-filter>
    </activity>        
            <intent-filter>                    <category android:name="android.intent.category.LAUNCHER"/>        </intent-filter>        <intent-filter>                    <category android:name="android.intent.category.DEFAULT"/>        </intent-filter>  </activity>
    </application>

  <uses-permission android:name="android.permission.CAMERA"/>
</manifest>

logcat 跟踪非常长:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
D/RILJ    ( 1470): [1696]< SCREEN_STATE error: com.android.internal.telephony.Co
mmandException: GENERIC_FAILURE
D/HTC_RIL ( 1211): (t=1299683238)%% +HTCUCSQ: 18\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683241)%% +HTCUCSQ: 19\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683250)%% +HTCUCSQ: 18\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683253)%% +HTCUCSQ: 19\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683256)%% +HTCUCSQ: 18\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683259)%% +HTCUCSQ: 17\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683265)%% +HTCUCSQ: 20\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683268)%% +HTCUCSQ: 19\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683271)%% +HTCUCSQ: 18\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683274)%% +HTCUCSQ: 17\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683280)%% +HTCUCSQ: 16\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683283)%% +HTCUCSQ: 17\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683286)%% +HTCUCSQ: 19\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683295)%% +HTCUCSQ: 18\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683304)%% +HTCUCSQ: 19\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683310)%% +HTCUCSQ: 20\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683322)%% +HTCUCSQ: 18\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683325)%% +HTCUCSQ: 19\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683331)%% +HTCUCSQ: 20\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683334)%% +HTCUCSQ: 22\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683344)%% +HTCUCSQ: 15\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683347)%% +HTCUCSQ: 17\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683350)%% +HTCUCSQ: 16\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683353)%% +HTCUCSQ: 13\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683356)%% +HTCUCSQ: 15\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683359)%% +HTCUCSQ: 19\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683362)%% +HTCUCSQ: 21\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683374)%% +HTCUCSQ: 22\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683386)%% +HTCUCSQ: 21\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683389)%% +HTCUCSQ: 20\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683392)%% +HTCUCSQ: 21\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683398)%% +HTCUCSQ: 20\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683407)%% +HTCUCSQ: 21\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683413)%% +HTCUCSQ: 20\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683419)%% +HTCUCSQ: 21\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683425)%% +HTCUCSQ: 20\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683428)%% +HTCUCSQ: 17\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683431)%% +HTCUCSQ: 15\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683434)%% +HTCUCSQ: 16\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683437)%% +HTCUCSQ: 17\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683440)%% +HTCUCSQ: 18\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683443)%% +HTCUCSQ: 19\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683455)%% +HTCUCSQ: 20\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683458)%% +HTCUCSQ: 21\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683470)%% +HTCUCSQ: 20\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683473)%% +HTCUCSQ: 18\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683476)%% +HTCUCSQ: 14\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683482)%% +HTCUCSQ: 15\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683485)%% +HTCUCSQ: 17\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683494)%% +HTCUCSQ: 18\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683497)%% +HTCUCSQ: 19\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683500)%% +HTCUCSQ: 17\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683503)%% +HTCUCSQ: 18\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683506)%% +HTCUCSQ: 19\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683512)%% +HTCUCSQ: 16\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683521)%% +HTCUCSQ: 18\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683527)%% +HTCUCSQ: 19\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683530)%% +HTCUCSQ: 18\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683536)%% +HTCUCSQ: 17\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683539)%% +HTCUCSQ: 16\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683542)%% +HTCUCSQ: 17\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/RILJ    ( 1470): [1697]> SCREEN_STATE: false
W/RILSWITCH( 1211): RIL REQUEST: SCREEN_STATE --> Vendor RIL
D/HTC_RIL ( 1211): ril_func_screen_state_notified():called
D/HTC_RIL ( 1211): fd_ballots():AP 0 votes to enable fast dormancy!
D/HTC_RIL ( 1211): (t=1299683544)>> AT+ENCSQ=0\
D/GSM     ( 1470): [DataConnection] Stop poll NetStat
D/GSM     ( 1470): [DataConnection] Start poll NetStat
D/HTC_RIL ( 1211): (t=1299683544)<< 0\
D/HTC_RIL ( 1211): (t=1299683544)>> AT+CREG=1\
D/HTC_RIL ( 1211): (t=1299683544)<< 0\
D/HTC_RIL ( 1211): (t=1299683544)>> AT+CSQ\
D/HTC_RIL ( 1211): (t=1299683544)<< +CSQ: 17,99\
\
0\
D/HTC_RIL ( 1211): (t=1299683544)>> AT@HTCPDPFD=1\
D/HTC_RIL ( 1211): (t=1299683544)XX @PDPFD: garbage_count=0\
\

D/HTC_RIL ( 1211): (t=1299683544)<< 0\
D/HTC_RIL ( 1211): (t=1299683544)>> AT+HTCPDPFD=1\
D/HTC_RIL ( 1211): (t=1299683544)<< 4\
D/RILSWITCH( 1211): RILD <-- RIL (token 0xd298)
D/RILSWITCH( 1211): atdToken : 0xd298, bECMRedirected 0
D/RILJ    ( 1470): [1697]< SCREEN_STATE error: com.android.internal.telephony.Co
mmandException: GENERIC_FAILURE
D/RILJ    ( 1470): [1698]> SCREEN_STATE: true
W/RILSWITCH( 1211): RIL REQUEST: SCREEN_STATE --> Vendor RIL
D/HTC_RIL ( 1211): ril_func_screen_state_notified():called
D/HTC_RIL ( 1211): fd_ballots():AP 0 votes to disable fast dormancy!
D/HTC_RIL ( 1211): (t=1299683723)>> AT+ENCSQ=1\
D/HTC_RIL ( 1211): (t=1299683723)<< 0\
D/HTC_RIL ( 1211): (t=1299683723)>> AT+CREG=2\
D/GSM     ( 1470): [DataConnection] Stop poll NetStat
D/GSM     ( 1470): [DataConnection] Start poll NetStat
D/HTC_RIL ( 1211): (t=1299683723)<< 0\
D/HTC_RIL ( 1211): (t=1299683723)>> AT+CSQ\
D/HTC_RIL ( 1211): (t=1299683723)<< +CSQ: 20,0\
\
0\
D/HTC_RIL ( 1211): (t=1299683723)>> AT+CREG?\
D/HTC_RIL ( 1211): (t=1299683723)<< +CREG: 2,1,"9CCE","000060ED"\
\
0\
D/HTC_RIL ( 1211): (t=1299683723)>> AT+CGREG?\
D/HTC_RIL ( 1211): (t=1299683723)<< +CGREG: 1,1\
\
0\
D/HTC_RIL ( 1211): (t=1299683723)>> AT+COPS=3,2;+COPS?\
D/HTC_RIL ( 1211): (t=1299683723)<< +COPS: 0,2,"31026",3\
\
0\
D/HTC_RIL ( 1211): (t=1299683723)>> AT@HTCPDPFD=0\
D/HTC_RIL ( 1211): (t=1299683723)XX @PDPFD: garbage_count=0\
\

D/HTC_RIL ( 1211): (t=1299683723)<< 0\
D/HTC_RIL ( 1211): (t=1299683723)>> AT+HTCPDPFD=0\
D/HTC_RIL ( 1211): (t=1299683723)<< 4\
D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/RILSWITCH( 1211): RILD <-- RIL (token 0xdf88)
D/RILSWITCH( 1211): atdToken : 0xdf88, bECMRedirected 0
D/RILJ    ( 1470): [1698]< SCREEN_STATE error: com.android.internal.telephony.Co
mmandException: GENERIC_FAILURE
D/HTC_RIL ( 1211): (t=1299683725)%% +HTCUCSQ: 19\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683731)%% +HTCUCSQ: 20\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683734)%% +HTCUCSQ: 21\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683740)%% +HTCUCSQ: 19\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683758)%% +HTCUCSQ: 20\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683761)%% +HTCUCSQ: 19\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683770)%% +HTCUCSQ: 18\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683779)%% +HTCUCSQ: 17\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683782)%% +HTCUCSQ: 18\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683788)%% +HTCUCSQ: 17\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683791)%% +HTCUCSQ: 18\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683794)%% +HTCUCSQ: 16\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683797)%% +HTCUCSQ: 15\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/HTC_RIL ( 1211): (t=1299683800)%% +HTCUCSQ: 17\
\

D/RILSWITCH( 1211): Vendor RIL ----> UNSOLICITED: 1009
D/RILSWITCH( 1211): Sending vendor RIL unsolicited message to rild
D/RILJ    ( 1470): [1699]> SCREEN_STATE: false
W/RILSWITCH( 1211): RIL REQUEST: SCREEN_STATE --> Vendor RIL
D/HTC_RIL ( 1211): ril_func_screen_state_notified():called
D/HTC_RIL ( 1211): fd_ballots():AP 0 votes to enable fast dormancy!
D/HTC_RIL ( 1211): (t=1299683802)>> AT+ENCSQ=0\
D/HTC_RIL ( 1211): (t=1299683802)<< 0\
D/HTC_RIL ( 1211): (t=1299683802)>> AT+CREG=1\
D/GSM     ( 1470): [DataConnection] Stop poll NetStat
D/GSM     ( 1470): [DataConnection] Start poll NetStat
D/HTC_RIL ( 1211): (t=1299683802)<< 0\
D/HTC_RIL ( 1211): (t=1299683802)>> AT+CSQ\
D/HTC_RIL ( 1211): (t=1299683802)<< +CSQ: 17,99\
\
0\
D/HTC_RIL ( 1211): (t=1299683802)>> AT@HTCPDPFD=1\
D/HTC_RIL ( 1211): (t=1299683802)XX @PDPFD: garbage_count=0\
\

D/HTC_RIL ( 1211): (t=1299683802)<< 0\
D/HTC_RIL ( 1211): (t=1299683802)>> AT+HTCPDPFD=1\
D/HTC_RIL ( 1211): (t=1299683802)<< 4\
D/RILSWITCH( 1211): RILD <-- RIL (token 0xd298)
D/RILSWITCH( 1211): atdToken : 0xd298, bECMRedirected 0
D/RILJ    ( 1470): [1699]< SCREEN_STATE error: com.android.internal.telephony.Co
mmandException: GENERIC_FAILURE


您要调用已安装的条形码扫描仪应用吗?一周前我也做过同样的事情。

这是我的代码:

1
2
3
Intent intent = new Intent("com.google.zxing.client.android.SCAN");
intent.putExtra("SCAN_MODE","PRODUCT_MODE");
startActivityForResult(intent, 0);

AndroidManifest.xml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="de.myPackage"
      android:versionCode="1"
      android:versionName="1.0">
   
        <activity android:name=".MyApp"
                  android:label="@string/app_name">
            <intent-filter>
               
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

    </application>

<uses-permission android:name="android.permission.INTERNET"></uses-permission>
</manifest>

希望这会有所帮助。


ZXing 项目在他们的 Wiki 上提供了一些通过 Intent 调用 XZing 的代码:

http://code.google.com/p/zxing/source/browse/trunk/android-integration/src/com/google/zxing/integration/android/IntentIntegrator.java

如果您正在使用该代码,则无需在清单文件中添加任何内容。从您的活动中,您可以调用

1
IntentIntegrator.initiateScan(this);

这将负责验证 ZXing 是否已安装,如果未安装,则提示用户通过 Marketplace 安装它。