Skip to content
This repository was archived by the owner on Aug 16, 2021. It is now read-only.

Initialize_en

Hengyu Liu edited this page Dec 20, 2017 · 3 revisions

We recommend you init with func onCreate in Application:

public class App extends Application {
    @Override
    public void onCreate() {
        super.onCreate();

      	//Init the WearTools, and match the system version automatically 
        try {
            WTUtils.init(this,WTUtils.MODE_AUTO);
        } catch (NoAvailableServiceException e) {
            e.printStackTrace();
        }
    }
}

You have to register Application in manifest:

...
<application
        android:name="cc.chenhe.lib.weartools.demo.App"
		...
</application>
...

Notice: We do not recommend you to use auto matching system on the phone, because in this auto mode, the sdk will judge whether will go into Ticwear mode by finding whether the current device has Ticwear App installed, but not by the current connection. Let's assume that the user installed both Ticwear and Android Wear, but had Android Wear device connected. In this specific circumstance, the sdk will make mistake that choose the wrong mode and leads to more disfunction. Tips We do recommend you to choose the mode based on your target users, or just let users make their choice.

Notice: ApiClient has to be managed by WearTools, which means you should not create, connect, or release manually.

Clone this wiki locally