2017-10-02 22 views
-1

私はウェアラブルリスナーサービスを使用しようとしましたが、廃止されているようです。smartwatchからアクティビティやサービスを開始する方法

public void lockdevice(View view) { 
    Intent intent = new Intent(); 
    intent.setClass(this, MainActivity.class); 
    intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
    RemoteIntent.startRemoteActivity(this, intent,null); 
} 

は、それが例外を作成します:

は、ここに私の現在のコードである

Only android.intent.action.VIEW action is currently supported for starting a remote activity 

しかし、ビューのアクションは非常に私を助けにはなりません。これを行う他の方法はありますか?

答えて

0

WearableListenerServiceは廃止されていません。ハンドヘルド上のServiceがリンクされたウェアラブルから開始されるためには、これはまだ推奨されているスーパークラスです。 Serviceが起動したら、必要に応じてActivityを簡単に起動できます。

ここにはよく記載されています。https://developer.android.com/training/wearables/data-layer/events.html

関連する問題