Permissions for WearableListenerService

I implemented WearableListenerServiceboth in my main application and in the Wear companion app. In the manifest, the service must be declared as android:exported="true"(or not declared at all and left by default true), since it is launched by Google Play services. An exported service without any permissions can be called by any application in the system, but I can’t find the correct permission to add a service to the advertisement to protect it. I looked at the resolutions on the phone and Wear device with pm list permissions, but I don't see anything like what I need.

  • Is there any permission I can / should add to protect my services?
  • If not, is it recommended that you manually protect the service by checking the name of the caller's package?
+4
source share
2 answers

The best way to see how to implement WearableListenerService on Android Wear is to look at one of the existing samples provided by the SDK. If you look at the DataLayer sample included in the $ SDK / samples / android-20 / wearable / DataLayer file, it fully implements what you want to do.

If you look in AndroidManifest.xml for the wearable side, you will see that it has the following:

    <meta-data
            android:name="com.google.android.gms.version"
            android:value="@integer/google_play_services_version" />

    <service
            android:name=".DataLayerListenerService" >
        <intent-filter>
            <action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
        </intent-filter>
    </service>

... , . , . WearableListenerService , , , , , - Google Play, , , , .

, , Wear SDK, , - ..

+10
  • , / ?
  • , , ?

WearableListenerService . @Wayne : there is a security check that happens in the framework. WearableListenerService. Wearable SDK : https://labs.mwrinfosecurity.com/blog/android-wear-security-analysis. :

pr() , com.google.android.gms Google cU(), , UID com.google.android.gms ( Google Play). , , , WearableListenerService.

 

, Lint checker , BIND_LISTENER ( , ):

, . .

, , ( , BIND_LISTENER ). Android. , , tools:ignore="ExportedService" .

+2

All Articles