1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-09-27 16:56:57 +02:00

Debug: Add button to send a PebbleKit notification

This commit is contained in:
Andreas Shimokawa 2018-11-01 15:04:16 +01:00
parent f3e16c5b1d
commit 22de76620d
2 changed files with 22 additions and 0 deletions

View File

@ -224,6 +224,14 @@ public class DebugActivity extends AbstractGBActivity {
}
});
Button testPebbleKitNotificationButton = findViewById(R.id.testPebbleKitNotificationButton);
testPebbleKitNotificationButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
testPebbleKitNotification();
}
});
Button fetchDebugLogsButton = findViewById(R.id.fetchDebugLogsButton);
fetchDebugLogsButton.setOnClickListener(new View.OnClickListener() {
@Override
@ -328,6 +336,13 @@ public class DebugActivity extends AbstractGBActivity {
}
}
private void testPebbleKitNotification() {
Intent pebbleKitIntent = new Intent("com.getpebble.action.SEND_NOTIFICATION");
pebbleKitIntent.putExtra("messageType", "PEBBLE_ALERT");
pebbleKitIntent.putExtra("notificationData", "[{\"title\":\"PebbleKitTest\",\"body\":\"sent from Gadgetbridge\"}]");
getApplicationContext().sendBroadcast(pebbleKitIntent);
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
switch (item.getItemId()) {

View File

@ -124,6 +124,13 @@
grid:layout_columnSpan="2"
grid:layout_gravity="fill_horizontal"
android:text="create test notification" />
<Button
android:id="@+id/testPebbleKitNotificationButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
grid:layout_columnSpan="2"
grid:layout_gravity="fill_horizontal"
android:text="create PebbleKit test notification" />
<Button
android:id="@+id/fetchDebugLogsButton"
android:layout_width="wrap_content"