Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid application Id - chromecast

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
like image 252
Zeus Avatar asked Dec 19 '22 18:12

Zeus


2 Answers

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.

like image 98
Ali Naddaf Avatar answered Jan 29 '23 11:01

Ali Naddaf


Remove quotation mark:

- CastMediaControlIntent.categoryForCast("CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID")
+ CastMediaControlIntent.categoryForCast(CastMediaControlIntent.DEFAULT_MEDIA_RECEIVER_APPLICATION_ID)
like image 40
Evgenii Vandyshev Avatar answered Jan 29 '23 09:01

Evgenii Vandyshev