Per USB devi usare le librerie che accedono a USB. Mi pare sia complicato.già visto tempo fà ma utilizza la connessione tcpip, a me serve USB per intercettare i Log di una app che gira su un tablet.
Potresti creare un progettino B4J che utilizzi il server ADB (lanciandolo col comando Shell).Vorrei realizzare un applicativo B4J che mi permetta di leggere i Log di una App installata su un tablet, collegato via Usb al PC.
Esiste qualcosa, avete qualche suggerimento ?
Erel usa adb mi pare per intercettare i log per B4APotresti creare un progettino B4J che utilizzi il server ADB (lanciandolo col comando Shell).
adb.exe logcat -v threadtime [device id] > C:\android-debug.log
Il comando qui sopra invierebbe il log ad un file di testo, che potresti visualizzare nel tuo progetto B4J.
Devi però ottenere il [device id]:
adb.exe devices
per ottenere una lista dei dispositivi connessi.
Funziona, è da gestire, per ADB leggePotresti creare un progettino B4J che utilizzi il server ADB (lanciandolo col comando Shell).
adb.exe logcat -v threadtime [device id] > C:\android-debug.log
Il comando qui sopra invierebbe il log ad un file di testo, che potresti visualizzare nel tuo progetto B4J.
Devi però ottenere il [device id]:
adb.exe devices
per ottenere una lista dei dispositivi connessi.
05-01 18:46:50.434 471 471 W WindowManager: Attempted to remove non-existing token: android.os.Binder@30fe8d9
05-01 18:46:50.472 221 1894 I NX_FFmpegExtractor: ffmpeg uri:
05-01 18:46:50.472 221 1894 I NX_FFmpegExtractor: android source: 0xa49ff6f8
05-01 18:46:50.472 221 1894 D FFMPEG : android source begin open
05-01 18:46:50.472 221 1894 D FFMPEG : android open, url: android-source:0xa49ff6f8
05-01 18:46:50.472 221 1894 D FFMPEG : ffmpeg open android data source success, source ptr: 0xa49ff6f8
05-01 18:46:50.473 221 1894 D FFMPEG : android source open success
05-01 18:46:50.478 3259 3259 I B4A : ~i:** Activity (main) Pause, UserClosed = false **
05-01 18:46:50.484 3259 3259 I B4A : ~l34262153:Activity_Pause chiusura forzata
05-01 18:46:50.485 3259 3259 I Choreographer: Skipped 32 frames! The application may be doing too much work on its main thread.
05-01 18:46:50.493 221 1894 I NX_FFmpegExtractor: FFmpegExtrator::Better2SniffFFMPEG url: android-source:0xa49ff6f8, format_name: ogg, format_long_name: Ogg
05-01 18:46:50.493 221 1894 I NX_FFmpegExtractor: Better2SniffFFMPEG() :Have no video stream for playable.!!
05-01 18:46:50.494 221 1894 D FFMPEG : android source close
05-01 18:46:50.494 221 1894 W NX_FFmpegExtractor: sniff through Better2SniffFFMPEG failed, try BetterSniffFFMPEG
05-01 18:46:50.494 221 1894 I MediaExtractor: Autodetected media content as 'application/ogg' with confidence 0.20
05-01 18:46:50.503 222 4576 D NuPlayerDriver: notifyListener_l(0xb4b2aea0), (1, 0, 0), loop setting(0, 0)
05-01 18:46:50.503 573 4575 D MediaPlayer: setSubtitleAnchor in MediaPlayer
Dim Log1 As String = $"05-01 18:46:50.434 471 471 W WindowManager: Attempted to remove non-existing token: android.os.Binder@30fe8d9
05-01 18:46:50.472 221 1894 I NX_FFmpegExtractor: ffmpeg uri:
05-01 18:46:50.472 221 1894 I NX_FFmpegExtractor: android source: 0xa49ff6f8
05-01 18:46:50.472 221 1894 D FFMPEG : android source begin open
05-01 18:46:50.472 221 1894 D FFMPEG : android open, url: android-source:0xa49ff6f8
05-01 18:46:50.472 221 1894 D FFMPEG : ffmpeg open android data source success, source ptr: 0xa49ff6f8
05-01 18:46:50.473 221 1894 D FFMPEG : android source open success
05-01 18:46:50.478 3259 3259 I B4A : ~i:** Activity (main) Pause, UserClosed = false **
05-01 18:46:50.484 3259 3259 I B4A : ~l34262153:Activity_Pause chiusura forzata
05-01 18:46:50.485 3259 3259 I Choreographer: Skipped 32 frames! The application may be doing too much work on its main thread.
05-01 18:46:50.493 221 1894 I NX_FFmpegExtractor: FFmpegExtrator::Better2SniffFFMPEG url: android-source:0xa49ff6f8, format_name: ogg, format_long_name: Ogg
05-01 18:46:50.493 221 1894 I NX_FFmpegExtractor: Better2SniffFFMPEG() :Have no video stream for playable.!!
05-01 18:46:50.494 221 1894 D FFMPEG : android source close
05-01 18:46:50.494 221 1894 W NX_FFmpegExtractor: sniff through Better2SniffFFMPEG failed, try BetterSniffFFMPEG
05-01 18:46:50.494 221 1894 I MediaExtractor: Autodetected media content as 'application/ogg' with confidence 0.20
05-01 18:46:50.503 222 4576 D NuPlayerDriver: notifyListener_l(0xb4b2aea0), (1, 0, 0), loop setting(0, 0)
05-01 18:46:50.503 573 4575 D MediaPlayer: setSubtitleAnchor in MediaPlayer"$
Dim rx As RegexBuilder
rx.Initialize.AppendEscaped("B4A").Append(rx.CharAny).AppendAtLeastOne.AppendEscaped($"${Chr(10)}"$)
Dim mat As Matcher = Regex.Matcher(rx.Pattern, Log1)
Do While mat.Find
Log(mat.Match)
lbl_log.Text = lbl_log.Text & mat.Match
Loop