-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Send request from wear device to phone on startup
On phone the dataservice is triggered every 3 hours and most of the times there is no change in the data. Hence, wear doesn't recieve any updates about the data. If the data is not stored on the wear device while the very first sync is made, it'll never recieve the data unless it is updated. Hence adding a simple timstamp to the data. This has its own downsides but atleast the wear device recieves the data.
- Loading branch information
Showing
7 changed files
with
147 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
app/src/main/java/io/github/protino/wearable/DataLayerListenerService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* Copyright 2016 Gurupad Mamadapur | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.github.protino.wearable; | ||
|
||
import android.content.Intent; | ||
import android.util.Log; | ||
|
||
import com.google.android.gms.wearable.MessageEvent; | ||
import com.google.android.gms.wearable.WearableListenerService; | ||
|
||
import static io.github.protino.fragment.ForecastFragment.LOG_TAG; | ||
|
||
/** | ||
* Listen to data update requests from nodes and start | ||
* {@link io.github.protino.wearable.WearableDataService} | ||
*/ | ||
public class DataLayerListenerService extends WearableListenerService { | ||
@Override | ||
public void onMessageReceived(MessageEvent messageEvent) { | ||
super.onMessageReceived(messageEvent); | ||
Log.d(LOG_TAG, "onMessageReceived: "); | ||
startService(new Intent(this, WearableDataService.class)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters