I was tweaking the Google Cast code, the one provided here.
I have the whole work space setup done, but, when trying to run the sample app on the Android phone, I get the following error.
I just assigned the package name as the app id. Where do I get the app Id? Should I register with Google for getting an app id? How does it work?
02-13 23:36:00.995: E/AndroidRuntime(8310): FATAL EXCEPTION: main
02-13 23:36:00.995: E/AndroidRuntime(8310): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.google.sample.cast.refplayer/com.google.sample.cast.refplayer.VideoBrowserActivity}: java.lang.IllegalArgumentException: Invalid appliation ID: com.google.sample.cast.refplayer
02-13 23:36:00.995: E/AndroidRuntime(8310): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1967)
02-13 23:36:00.995: E/AndroidRuntime(8310): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1992)
02-13 23:36:00.995: E/AndroidRuntime(8310): at android.app.ActivityThread.access$600(ActivityThread.java:127)
02-13 23:36:00.995: E/AndroidRuntime(8310): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1158)
02-13 23:36:00.995: E/AndroidRuntime(8310): at android.os.Handler.dispatchMessage(Handler.java:99)
02-13 23:36:00.995: E/AndroidRuntime(8310): at android.os.Looper.loop(Looper.java:137)
02-13 23:36:00.995: E/AndroidRuntime(8310): at android.app.ActivityThread.main(ActivityThread.java:4511)
02-13 23:36:00.995: E/AndroidRuntime(8310): at java.lang.reflect.Method.invokeNative(Native Method)
02-13 23:36:00.995: E/AndroidRuntime(8310): at java.lang.reflect.Method.invoke(Method.java:511)
02-13 23:36:00.995: E/AndroidRuntime(8310): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980)
02-13 23:36:00.995: E/AndroidRuntime(8310): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747)
02-13 23:36:00.995: E/AndroidRuntime(8310): at dalvik.system.NativeStart.main(Native Method)
02-13 23:36:00.995: E/AndroidRuntime(8310): Caused by: java.lang.IllegalArgumentException: Invalid appliation ID:
02-13 23:36:00.995: E/AndroidRuntime(8310): at com.google.android.gms.cast.CastMediaControlIntent.a(Unknown Source)
02-13 23:36:00.995: E/AndroidRuntime(8310): at com.google.android.gms.cast.CastMediaControlIntent.categoryForCast(Unknown Source)
02-13 23:36:00.995: E/AndroidRuntime(8310): at com.google.sample.castcompanionlibrary.cast.BaseCastManager.<init>(BaseCastManager.java:183)
02-13 23:36:00.995: E/AndroidRuntime(8310): at com.google.sample.castcompanionlibrary.cast.VideoCastManager.<init>(VideoCastManager.java:215)
02-13 23:36:00.995: E/AndroidRuntime(8310): at com.google.sample.castcompanionlibrary.cast.VideoCastManager.initialize(VideoCastManager.java:168)
02-13 23:36:00.995: E/AndroidRuntime(8310): at com.google.sample.cast.refplayer.CastApplication.getCastManager(CastApplication.java:51)
02-13 23:36:00.995: E/AndroidRuntime(8310): at com.google.sample.cast.refplayer.VideoBrowserActivity.onCreate(VideoBrowserActivity.java:55)
02-13 23:36:00.995: E/AndroidRuntime(8310): at android.app.Activity.performCreate(Activity.java:4470)
02-13 23:36:00.995: E/AndroidRuntime(8310): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1052)
02-13 23:36:00.995: E/AndroidRuntime(8310): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1931)
02-13 23:36:00.995: E/AndroidRuntime(8310): ... 11 more
02-13 23:36:01.115: D/dalvikvm(8310): GC_CONCURRENT freed 168K, 3% free 13426K/13831K, paused 7ms+7ms
02-13 23:36:01.305: I/Process(8310): Sending signal. PID: 8310 SIG: 9
The best way is to create your own receiver (Styled Media Receiver). When you register that, you get an app id; I suggest you go to Cast developers site and familiarize yourself with Chromecast and how it works. After you get an App Id, you need to insert that into res/values/string.xml where YOUR_APP_ID string is.
Remove quotation mark:
- CastMediaControlIntent.categoryForCast("CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID")
+ CastMediaControlIntent.categoryForCast(CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With