2014年7月4日金曜日

How to packaging watch face app with auto install.

I released a customizable Watch face app for Android.
Band O'Clock for Wear : Google Play


There are some tricks for enable auto-install from phone.

■ AndroidManifest.xml

This is a AndroidManifest.xml for Wear app.
If you set com.google.android.permission.PROVIDE_BACKGROUND permission, auto-install seems not happen, but you can still select this app for watch face. <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="my.package.name"> <uses-feature android:name="android.hardware.type.watch" /> <!-- if set this, auto-intall not happen --> <!--<uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" />--> <application android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@android:style/Theme.DeviceDefault"> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <activity android:name=".MainActivity" android:allowEmbedded="true" android:exported="true" android:label="@string/app_name" android:screenOrientation="portrait"> <meta-data android:name="com.google.android.clockwork.home.preview" android:resource="@drawable/preview" /> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="com.google.android.clockwork.home.category.HOME_BACKGROUND" /> </intent-filter> </activity> </application> </manifest>


■ build.gradle

For build.gradle I changed

compile 'com.google.android.gms:play-services-wearable:+'

to

compile 'com.google.android.gms:play-services:5.0.+@aar'

for both mobile and wear project.

I'm not sure it really affect to auto-install, I did not confirm yet.


0 件のコメント:

コメントを投稿