I am new to Android development since a few weeks, and I need to write an app that can display the user a live stream multicasted in UDP or RDP. The stream is located at an address such as "rtp://230.0.0.11:1234", and is emitted by WIFI thanks to this module :
http://www.ikusi.es/public/ctrl_public_prod.php?accion=verProducto&id_familia=34&id_gama=186&id_producto=351
I already tried to read it from a player (Daroon player, from PlayStore), and it worked well, so I assume that my foolowing problem is not due to the broadcast.
I saw that it is possible to display video content to the user by different ways :
Using a new Intent with an ACTION_VIEW, and Android selects an app that can view the content;
Using the MediaPlayer class and VideoView.
I have two issues, let us start with the most important :
- For both solution above, there is an issue : I read everywhere that MediaPlayer only support http/s and rtsp protocols, is that right? And for the action view here is what I tried before :
Uri streamURL = Uri.parse("rtp://230.0.0.11:1234");
Intent streamIntent = new Intent(Intent.ACTION_VIEW);
streamIntent.setData(streamURL);
// streamIntent.setDataAndType(streamURL,"video/*");
startActivity(streamIntent);
Here is the LogCat :
07-11 00:25:58.119: D/AndroidRuntime(2659): Shutting down VM
07-11 00:25:58.119: W/dalvikvm(2659): threadid=1: thread exiting with uncaught exception (group=0x40015560)
07-11 00:25:58.129: E/AndroidRuntime(2659): FATAL EXCEPTION: main
07-11 00:25:58.129: E/AndroidRuntime(2659): java.lang.IllegalStateException: Could not execute method of the activity
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.view.View$1.onClick(View.java:2144)
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.view.View.performClick(View.java:2485)
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.view.View$PerformClick.run(View.java:9080)
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.os.Handler.handleCallback(Handler.java:587)
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.os.Handler.dispatchMessage(Handler.java:92)
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.os.Looper.loop(Looper.java:123)
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.app.ActivityThread.main(ActivityThread.java:3683)
07-11 00:25:58.129: E/AndroidRuntime(2659): at java.lang.reflect.Method.invokeNative(Native Method)
07-11 00:25:58.129: E/AndroidRuntime(2659): at java.lang.reflect.Method.invoke(Method.java:507)
07-11 00:25:58.129: E/AndroidRuntime(2659): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
07-11 00:25:58.129: E/AndroidRuntime(2659): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
07-11 00:25:58.129: E/AndroidRuntime(2659): at dalvik.system.NativeStart.main(Native Method)
07-11 00:25:58.129: E/AndroidRuntime(2659): Caused by: java.lang.reflect.InvocationTargetException
07-11 00:25:58.129: E/AndroidRuntime(2659): at java.lang.reflect.Method.invokeNative(Native Method)
07-11 00:25:58.129: E/AndroidRuntime(2659): at java.lang.reflect.Method.invoke(Method.java:507)
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.view.View$1.onClick(View.java:2139)
07-11 00:25:58.129: E/AndroidRuntime(2659): ... 11 more
07-11 00:25:58.129: E/AndroidRuntime(2659): Caused by: android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=rtp://230.0.0.11:1234 }
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.app.Instrumentation.checkStartActivityResult(Instrumentation.java:1409)
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.app.Instrumentation.execStartActivity(Instrumentation.java:1379)
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.app.Activity.startActivityForResult(Activity.java:2827)
07-11 00:25:58.129: E/AndroidRuntime(2659): at android.app.Activity.startActivity(Activity.java:2933)
07-11 00:25:58.129: E/AndroidRuntime(2659): at fr.infosat.tvreplay.MainActivity.listStream(MainActivity.java:35)
07-11 00:25:58.129: E/AndroidRuntime(2659): ... 14 more
07-11 00:26:00.079: I/Process(2659): Sending signal. PID: 2659 SIG: 9
My understanding is that the error InvocationTargetException, usually due to error on class names, cannot be resolved directly here, since I don't call any class in startActivity. However I think my syntax is not correct, maybe the method is not the right one to use. Of course if I uncomment the setDataAndType line, it displays the same error.
I noticed the error come when I launch my implicit intent.
My second problem is that Daroon Player works well on my set top box, I can see my stream on my TV. But when I try to launch it from Eclipse emulator, it doesn't play, even if I can play it from VLC... Is the emulator powerful enough to read those kind of stream?
I hope that you have some clues on how to solve that! :)
First, you get the exception because there is no app installed on your device which can handle such an rtp:// url.
You may want to check the intent before you start it: queryIntentActivities(..)
Second, I think emulator is pretty slow compared to any available real device, you may not want to use emulator to test A/V streaming.
VLC Android SDK works really perfect in UDP/RTP
https://code.videolan.org/videolan/vlc-android
libvlc
Related
Many times to open the WebView, resulting in a number of WebView, it is estimated that the memory leak, I would like to ask a way to solve it?
Shutting down VM
threadid=1: thread exiting with uncaught exception (group=0xa617e908)
uncaughtException java.lang.NullPointerException
java.lang.NullPointerException
at android.webkit.WebViewClassic.loadUrlImpl(WebViewClassic.java:2525)
at android.webkit.WebViewClassic.loadUrlImpl(WebViewClassic.java:2541)
at android.webkit.WebViewClassic.loadUrl(WebViewClassic.java:2534)
at android.webkit.WebView.loadUrl(WebView.java:784)
at cn.nin.common.MyAndroid$MyAsyncTask.onPostExecute(MyAndroid.java:1461)
at cn.nin.common.MyAndroid$MyAsyncTask.onPostExecute(MyAndroid.java:1362)
at android.os.AsyncTask.finish(AsyncTask.java:631)
at android.os.AsyncTask.access$600(AsyncTask.java:177)
at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5041)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
You didn't give us enough information. NullPointerException can be thrown for many reasons.That error means that an application attempts to use an object reference that has the null value.
I am trying to get my android app invoke HP ePrint PDF Preview Activity.
Intent intent = new Intent ();
intent.setPackage("com.hp.android.print");
intent.setClassName("com.hp.android.print", "com.hp.android.print.preview.PdfPreviewActivity");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
Uri uri = Uri.parse("http://www.pdf995.com/samples/pdf.pdf");
intent.setDataAndType( uri, "application/pdf" );
if (intent.resolveActivity(getPackageManager()) != null)
{
getBaseContext().startActivity(intent);
}
I am getting the below error (taken from Logcat of the device):
2014-03-13 03:02:20.915 D 11119/AndroidRuntime: Shutting down VM
2014-03-13 03:02:20.915 W 11119/dalvikvm: threadid=1: thread exiting with uncaught exception (group=0x40a491f8)
2014-03-13 03:02:20.925 E 11119/AndroidRuntime: FATAL EXCEPTION: main
**java.lang.RuntimeException: Unable to start activity ComponentInfo{com.hp.android.print/com.hp.android.print.preview.PdfPreviewActivity}:** java.lang.NullPointerException
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1956)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1981)
at android.app.ActivityThread.access$600(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1147)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
**Caused by: java.lang.NullPointerException
at com.hp.android.print.utils.UriUtils.normalizeIntent(UriUtils.java:133)**
at com.hp.android.print.preview.PdfPreviewActivity.onContinueCreate(PdfPreviewActivity.java:123)
at com.hp.android.print.preview.PrintPreview.handleExternalReceivedIntent(PrintPreview.java:261)
at com.hp.android.print.preview.PrintPreview.onCreate(PrintPreview.java:181)
at android.app.Activity.performCreate(Activity.java:4465)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1049)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1920)
... 11 more
2014-03-13 03:02:20.935 W 132/ActivityManager: Force finishing activity com.hp.android.print/.preview.PdfPreviewActivity
2014-03-13 03:02:20.955 W 132/ActivityManager: Force finishing activity com.example.droidprinttest/.MainActivity
HP ePrint works fine when used manually. Any idea about a fix?
[EDIT] My Goal is to get a PDF file printed on the fly, a solution without preview is okay for me too.
Decided to use Scandit SDK to get the barcode scanning feature in my app. Unfortunately, since I'm relatively new to Android development and Java in general I've run into a few issues that I can't seem to work out. The demo that Scandit provided doesn't give any errors(runs fine) but crashes when I try to start it up (pressing a button from one activity is meant to start it up). I've tried reading the logcat and googling a solution to the problems but I'm not getting the right solutions. Does anyone have an idea of what I'm doing wrong?
Logcat is provided below:
10-08 23:30:00.807 21563-21563/com.kwesimbia.management D/AndroidRuntime? Shutting down VM
10-08 23:30:00.807 21563-21563/com.kwesimbia.management W/dalvikvm? threadid=1: thread exiting with uncaught exception (group=0x40aa4228)
10-08 23:30:00.817 21563-21563/com.kwesimbia.management E/AndroidRuntime? FATAL EXCEPTION: main
java.lang.IllegalStateException: Could not execute method of the activity
at android.view.View$1.onClick(View.java:3082)
at android.view.View.performClick(View.java:3549)
at android.view.View$PerformClick.run(View.java:14393)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4944)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at android.view.View$1.onClick(View.java:3077)
at android.view.View.performClick(View.java:3549)
at android.view.View$PerformClick.run(View.java:14393)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4944)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NoClassDefFoundError: com.kwesimbia.management.ScanditSDKDemoSimple
at com.kwesimbia.management.Activity_D.initiateCodeScan(Activity_D.java:63)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at android.view.View$1.onClick(View.java:3077)
at android.view.View.performClick(View.java:3549)
at android.view.View$PerformClick.run(View.java:14393)
at android.os.Handler.handleCallback(Handler.java:605)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:4944)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
10-08 23:30:00.817 32726-587/? E/EmbeddedLogger? App crashed!
Process: com.kwesimbia.management
10-08 23:30:00.817 32726-587/? E/EmbeddedLogger? App crashed!
Package: com.kwesimbia.management v1 (1.0)
10-08 23:30:00.817 32726-587/? E/EmbeddedLogger?
Application Label: firstapp
10-08 23:30:00.827 32726-587/? W/ActivityManager?
Force finishing activity com.kwesimbia.management/.Activity_D
I came across this problem as well, my solution was to extract the library files and put them as their files in the lib folder
The library basically isn't being exported with it
EDIT
So I checked out my project, basically I did these things:
In the libs folder I have a new folder called armeabi and inside that I have libscanditsdk-android-3.3.1.so
Then in my build path I have also referenced the jar file that they provide:
<classpathentry exported="true" kind="lib" path="C:/GIT/Android/FwayScannerProject/FwayScanner/libs/scanditsdk-barcodepicker-android-3.3.1.jar"/>
I got the exception message from user.
java.lang.NullPointerException
at android.app.ActivityThread.setupGraphicsSupport(ActivityThread.java:3738)
at android.app.ActivityThread.handleBindApplication(ActivityThread.java:3808)
at android.app.ActivityThread.access$1300(ActivityThread.java:127)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1197)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4507)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
at dalvik.system.NativeStart.main(Native Method)
He uses samsung galaxy S2 (ICS 4.0.3 with tegrak kernel and ADW launcher ex)
It's difficult to find what's the problem with this exception log.
Can anybody suggest a starting point to find why this exception raised.
Thanks.
I encountered similar problem as this.
The crash report is from Google Play and I can't reproduce it by myself. I tried to download Launcher Pro but that wasn't causing any troubles.
Here is the stack trace:
java.lang.RuntimeException: Failed to register input channel. Check logs for details.
at android.view.InputQueue.nativeRegisterInputChannel(Native Method)
at android.view.InputQueue.registerInputChannel(InputQueue.java:92)
at android.service.wallpaper.WallpaperService$Engine.updateSurface(WallpaperService.java:534)
at android.service.wallpaper.WallpaperService$Engine.attach(WallpaperService.java:670)
at android.service.wallpaper.WallpaperService$IWallpaperEngineWrapper.executeMessage(WallpaperService.java:898)
at com.android.internal.os.HandlerCaller$MyHandler.handleMessage(HandlerCaller.java:61)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:130)
at android.app.ActivityThread.main(ActivityThread.java:3806)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:507)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
at dalvik.system.NativeStart.main(Native Method)