AndroidWearable-Samples
AndroidWearable-Samples copied to clipboard
FindMyPhone
I tried to run FindMyPhone from Android Studio but there is no activity provided for the Application module. I added an empty MainActivity.
public class MainActivity extends Activity {
}
And created a listing in the mainfest
<activity
android:name=".MainActivity"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
I also notice the mainifest indicates this service is not found android:name="com.example.android.wearable.findphone.SoundAlarmListenerService" >
But I do have SoundAlarmListenerService.java in the path.
When I run the Wearable the alarm does not trigger on the phone.
Hi Jacky, I guess you could start the service after boot complete. Like this Answer, make a application without any activity and a service only.
Your MainActivity should display the layout and start the service. Then, my phone is well ringing.
public class MainActivity extends Activity {
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); startService(new Intent(this, SoundAlarmListenerService.class)); } }