I will try to explain this best I can but as you all know I'm not the best with using the right terms, so correct me where I am wrong.
Wearable data layer Messages can have a static (set in manifest / service) or dynamic (set in code) listeners. I think I have the dynamic sorted,but the static I am struggling with. Here is how it would be done in java.
Step 1:
Add the following to the manifest
I have covered this with a user instruction to add this code to manifest editor
Step 2:
Create a ListenerService with callbacks with
This is the step i'm struggling with. Now obviously I want the easiest experience for the end user. The best way I can think it might work is to create this service within the library (is this possible). Then raise events to a predefined b4a service created by the b4a user.
Is this what NotificationListener library does?
Is this the best way? what are my options?
Is this approach known as a Helper Service?
Thank you
Wearable data layer Messages can have a static (set in manifest / service) or dynamic (set in code) listeners. I think I have the dynamic sorted,but the static I am struggling with. Here is how it would be done in java.
Step 1:
Add the following to the manifest
B4X:
<application>
...
<service
android:name=".ListenerService" >
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
</intent-filter>
</service>
</application>
I have covered this with a user instruction to add this code to manifest editor
B4X:
AddApplicationText(
<service android:name=".ListenerService" >
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
</intent-filter>
</service>
Step 2:
Create a ListenerService with callbacks with
B4X:
public class ListenerService extends WearableListenerService {
@Override
public void onMessageReceived(MessageEvent messageEvent) {
showToast(messageEvent.getPath());
}
private void showToast(String message) {
Toast.makeText(this, message, Toast.LENGTH_LONG).show();
}
}
This is the step i'm struggling with. Now obviously I want the easiest experience for the end user. The best way I can think it might work is to create this service within the library (is this possible). Then raise events to a predefined b4a service created by the b4a user.
Is this what NotificationListener library does?
Is this the best way? what are my options?
Is this approach known as a Helper Service?
Thank you