Skip to content Skip to sidebar Skip to footer

Media_projection_service Not Valid In Call To Getsystemservice()

I am trying to develop an application that requires the ability to capture screen content. I'm targeting lollipop to avoid the requirement for root. When trying to get an instanc

Solution 1:

I get this error while getting Context.BLUETOOTH_SERVICEand the error doc (Must be one of..) contains Context.BLUETOOTH_SERVICE though.

This is not the way Android Studio "1.2" should work. :@

Anyway, its an Inspection bug, Constant and Resource Type mismatch (How in the hell Bluetooth is a resource in android context).

You can suppress this for Class/Method/Statement, for statement, add @SuppressWarnings("ResourceType") above or before the statement.

Another approach:

Goto Settings>>Editor>>Inspection>>Android>>Constant and Resource Type Mismatches and make the severity to anything but Error, probably Warning or Weak Warning.

(Though it fixes the error issue, but I want this mismatch to be an error when it really happens.)

Solution 2:

Run into the same problem, it is so strange, there are no any other threads talking about this problem. Well, actually you can just ignore this error and still run the program, even with the red marks on it

Post a Comment for "Media_projection_service Not Valid In Call To Getsystemservice()"