Skip to content

Commit abc4d26

Browse files
committed
fixed how permission activities are presented on watch faces
1 parent 367486d commit abc4d26

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

templates/WatchFaceManifest.xml.tmpl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
android:icon="@drawable/icon"
1111
android:supportsRtl="true"
1212
android:debuggable="true">
13+
<uses-library android:name="com.google.android.wearable" android:required="false"/>
1314
<service android:name=".MainService"
1415
android:label=""
1516
android:permission="android.permission.BIND_WALLPAPER">

templates/WatchFaceService.java.tmpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import android.support.v4.app.NotificationCompat;
1717
import android.support.v4.app.TaskStackBuilder;
1818
import android.support.v4.app.ActivityCompat.OnRequestPermissionsResultCallback;
1919
import android.support.v4.os.ResultReceiver;
20+
import android.support.wearable.activity.WearableActivity;
2021

2122
import processing.android.@@watchface_classs@@;
2223
import processing.core.PApplet;
@@ -92,8 +93,11 @@ public class MainService extends @@watchface_classs@@ {
9293
permIntent.putExtra(KEY_RESULT_RECEIVER, resultReceiver);
9394
permIntent.putExtra(KEY_PERMISSIONS, permissions);
9495
permIntent.putExtra(KEY_REQUEST_CODE, requestCode);
96+
permIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
97+
startActivity(permIntent);
9598

9699
// Create a notification on watch faces, otherwise it does not work.
100+
/*
97101
TaskStackBuilder stackBuilder = TaskStackBuilder.create(this);
98102
stackBuilder.addNextIntent(permIntent);
99103
PendingIntent permPendingIntent = stackBuilder.getPendingIntent(0, PendingIntent.FLAG_UPDATE_CURRENT);
@@ -108,6 +112,7 @@ public class MainService extends @@watchface_classs@@ {
108112
.setStyle(null);
109113
NotificationManager notificationManager = (NotificationManager)getSystemService(NOTIFICATION_SERVICE);
110114
notificationManager.notify(requestCode, builder.build());
115+
*/
111116
}
112117

113118
public static class PermissionRequestActivity extends Activity {

0 commit comments

Comments
 (0)