Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom privacy setting for requestPermission screen (expo) #188

Open
kamranesmaeili opened this issue Dec 22, 2024 · 1 comment
Open

Custom privacy setting for requestPermission screen (expo) #188

kamranesmaeili opened this issue Dec 22, 2024 · 1 comment

Comments

@kamranesmaeili
Copy link

I would like to add a custom privacy policy (web url or screen within the app) when the user is prompted to opt-in via requestPermission(permissions: Permission[]): Promise<Permission[]> method.

I have checked the documentation and searched online and apart from some guide from android developer website couldn't find any straight forward approach, that I can use in expo. An example of the privacy policy link that I would like to edit is as shown below:

image

Apologies in advance if this has already been answered

@matinzd
Copy link
Owner

matinzd commented Dec 23, 2024

To display your app's privacy policy, you can use the activity-alias tag, as outlined in the document.

If you're using Expo, there’s an Expo plugin available that helps configure parts of this library. However, for a custom implementation like this, you’ll need to handle it manually.

One straightforward approach is to create a native WebView pointing to your website's privacy policy URL. When users click the relevant link, an activity with the custom WebView will open, seamlessly displaying the privacy policy.

In the example app we have here I have pointed it to the MainActivity but you can create your own activity:

<activity-alias
android:name="ViewPermissionUsageActivity"
android:exported="true"
android:targetActivity=".MainActivity"
android:permission="android.permission.START_VIEW_PERMISSION_USAGE">
<intent-filter>
<action android:name="android.intent.action.VIEW_PERMISSION_USAGE" />
<category android:name="android.intent.category.HEALTH_PERMISSIONS" />
</intent-filter>
</activity-alias>

@matinzd matinzd added the Expo label Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants