react native android ask camera permission when user first logs in - android

I'm not familiar with the react-native app permissions for android and ios. I'm in thihs project which needs camera and audio permissions for videocalls that are already implemented and work fine.
The thing is that currently these permissions are asked the first time the users enters a videocall and that causes delay and bugs on the videocall flow. I'd like to aks these permissions the first time the users opens the app (they enter first to their profile or the dashboard, the videocall part happens afterwards), like I've seen other apps do.
This is the androidManifest.xml file that handles the permissions. I looked for a way to change when they're asked but I couldn't find anything on the format I'm currently at, and since it's new to me I don't want to change the behaviour completely by accident.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.rectnativetemplate">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
<application
android:name=".MainApplication"
android:usesCleartextTraffic="true"
android:label="#string/app_name"
android:requestLegacyExternalStorage="true"
android:icon="#mipmap/ic_launcher"
android:roundIcon="#mipmap/ic_launcher_round"
android:allowBackup="false"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:launchMode="singleTask"
android:windowSoftInputMode="adjustPan">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="dev--b45llct.us.auth0.com"
android:pathPrefix="/android/${applicationId}/callback"
android:scheme="${applicationId}" />
</intent-filter>
</activity>
------------
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
</manifest>
Is there a way to ask the permissions when the user first enters the app? And if it's possible, how can I implement the same behaviour on IOS?

Use request from PermissionsAndroid.
const granted = await PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.CAMERA);
if (granted === PermissionsAndroid.RESULTS.GRANTED) {
console.log('Camera permission granted');
} else {
console.log('Camera permission denied');
}

Related

camera and storage permissions isn't working in the webiew

I'm loading my website in webview. And inside that website also contains two buttons "Take photo" and "Upload". In the browser on the phone it works perfectly. As in, the "Take photo" button lets you take a photo, and the "Upload" button lets you upload a photo. But inside my app, it doesn't seem to do anything. And I know this has something to do with permissions. Here's my code:
AndroidManifest.xml:
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<application
android:allowBackup="true"
android:icon="#drawable/ic_favicon_1144_rounded"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/Theme.Test2">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
I haven't changed my MainActivity.kt at all, but if you want, I can edit this question and add it in.
This is not possible. From android app webview, you can not get access to device's permissions.

App update rejected in Google Developer Console

So, I made an update in my android app and uploaded the new APK file in the console. Unfortunately, I got this after a few hours
I am using firebase, so maybe that's why I get this problem. Here is my manifest.xml file.
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="theodosios.tziomakas.news">
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher_foreground"
android:label="#string/app_name"
android:largeHeap="true"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<!--Disable Analytics collection -->
<meta-data android:name="firebase_analytics_collection_enabled" android:value="false" />
<activity android:name="theodosios.tziomakas.news.MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="theodosios.tziomakas.news.StartActivity"
/>
<activity
android:name="theodosios.tziomakas.news.RegisterActivity"
android:parentActivityName="theodosios.tziomakas.news.StartActivity" />
<activity
android:name="theodosios.tziomakas.news.LoginActivity"
android:parentActivityName="theodosios.tziomakas.news.StartActivity" />
<activity
android:name="theodosios.tziomakas.news.ForgotPasswordActivity"
android:parentActivityName="theodosios.tziomakas.news.LoginActivity" />
<receiver android:name="theodosios.tziomakas.news.widget.NewsAppWidgetProvider">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data
android:name="android.appwidget.provider"
android:resource="#xml/news_app_widget_info" />
</receiver>
<service android:name="theodosios.tziomakas.news.widget.UpdateNewsWidgetService" />
<service
android:name="theodosios.tziomakas.news.widget.GridWidgetService"
android:permission="android.permission.BIND_REMOTEVIEWS" />
<activity
android:name="theodosios.tziomakas.news.DetailActivity"
android:parentActivityName="theodosios.tziomakas.news.MainActivity" />
<provider
android:name="theodosios.tziomakas.news.data.FavouriteProvider"
android:authorities="theodosios.tziomakas.news"
android:exported="false" />
<activity
android:name="theodosios.tziomakas.news.FavouriteNewsActivity"
android:parentActivityName="theodosios.tziomakas.news.MainActivity" />
<activity android:name="theodosios.tziomakas.news.CommentActivity" />
</application>
Make sure you follow these policies listed here link
Also read all these and make change to your app if you app did not follow any of these policy link
As in the email they do not mention the reason for rejection clearly. So you have to hit and try what changes you made in this app which are agains the policy.
Before submiting another update check your dashboard of that app, if previous app is still under processing or not. If it is still under update process. Do not submit another update. Wait for sometime to reflect some changes.
After making changes in your app after reading the policies then make new update. Now after update rejection this new update will take 7 to 10 days. Be calm and have patience.
Bonus tip: Also make sure your app store listing do not go against any policy. SO make sure you are not using any icon, discription or short discription which are related to any brand like youtube, facebook, whatsapp any brand name should not be there. Also your long discription should be readable like a normal paragraph and it should not be spammy which is filled with full of tags only.

React Native Deep Linking Application Not Opening

I followed all the steps from both the articles mentioned below
https://hackernoon.com/react-native-deep-linking-for-ios-and-android-d33abfba7ef3
https://medium.com/react-native-training/deep-linking-your-react-native-app-d87c39a1ad5e
After the app gets installed on my phone, I tried opening the app from the browser by giving the URL as peopleapp://people/1 format. Instead of opening the app, the browser opens Google search to search for the above.
I Used this application to open my Application by using my App Link(https://play.google.com/store/apps/details?id=com.manoj.dlt&hl=en_US) it's working.
But how to open the application from browser or from another application Using my App Link ?
Anyone has idea, how to solve this issue ?
Here is my Total AndroidManifest Code`
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.RECORD_AUDIO"/>
<uses-feature android:name="android.hardware.camera" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.FOREGROUND_SERVICE"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:name=".MainApplication"
android:allowBackup="false"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme"
android:usesCleartextTraffic="true">
<activity
android:name=".MainActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
android:screenOrientation="portrait"
android:label="#string/app_name"
android:windowSoftInputMode="adjustResize"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:label="filter_react_native">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="whizzard" android:host="article" />
</intent-filter>
</activity>
</application>
`
My Link is whizzard://article
As per google docs:
The functionality has changed slightly in Chrome for Android, versions 25 and later. It is no longer possible to launch an Android app by setting an iframe's src attribute. For example, navigating an iframe to a URI with a custom scheme such as paulsawesomeapp:// will not work even if the user has the appropriate app installed. Instead, you should implement a user gesture to launch the app via a custom scheme, or use the “intent:”.
You can read more about how intents work here. However, the tutorial you followed, for deeplinking will work on other browsers which are not chrome or chrome based.

Android Service Exception - Permission denied missing INTERNET permission

I have stumbled upon a problem I just can't seem to fix.
2 scenarios, in the first a user clicks a button which fires a method in MainActivity to make a web request. This works, no problem at all.
In the second scenario I want to make this request automatically in a service running in the background, as soon as the code moves into the Service, it makes a permission exception.
Caused by: java.lang.SecurityException: Permission denied (missing INTERNET permission?)
I can start up the service perfectly fine, but if I move any network requests into the service then I get into permission problems.
I already have <uses-permission android:name="android.permission.INTERNET"/> and <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>in my AndroidManifest.xml file.
I also do realtime permission checking (SDK 23+) in my MainActivity before starting the service, but this seems to have no effect on the permissions that the service gets.
Any ideas?
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="domain">
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity
android:name=".MainActivity"
android:label="#string/app_name"
android:theme="#style/AppTheme.NoActionBar">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<service
android:name="domain.RemoteCommunicationService"
android:isolatedProcess="true"
android:exported="true">
</service>
<receiver android:name="domain.RemoteServiceRestartReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="domain.RemoteServiceRestart"></action>
</intent-filter>
</receiver>
<receiver android:name="domain.RemoteCommunicationService$RemoteCommunicationReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="domain.RemoteCommunication.ToggleLight"></action>
</intent-filter>
</receiver>
</application>
You have use isolateProcess to true. Read what docs has to say:
If set to true, this service will run under a special process that is isolated from the rest of the system and has no permissions of its own. The only communication with it is through the Service API (binding and starting).

Android Permission Denial starting Intent for Wallpaper Settings

Unfortunately when I try to run my wallpaper I get an error message saying Permission Denial starting Intent and requires android.permission.BIND_WALLPAPER but I can't seem to figure out why. My manifest looks like the following:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.package">
<uses-feature android:name="android.software.live_wallpaper" />
<uses-permission android:name="android.permission.SET_WALLPAPER" />
<application
android:exported="true"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:permission="android.permission.BIND_WALLPAPER">
<service
android:name="WallpaperService"
android:icon="#drawable/icon"
android:label="#string/app_name"
android:permission="android.permission.BIND_WALLPAPER">
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
</intent-filter>
<meta-data
android:name="android.service.wallpaper"
android:resource="#xml/livewallpaper" />
</service>
<activity
android:name=".WallpaperSetClass"
android:exported="true"
android:permission="android.permission.BIND_WALLPAPER"
android:label="#string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
The live wallpaper does run perfectly if I set it through the live wallpaper part of my phone, but I would like to have a settings area as well to be able to open in which I can't.
At the moment my settings class is basically empty containing just an onCreate function and a layout with a button.
Is there something I'm missing? I seem to have the permissions along with android:exported
Turns out I had
android:permission="android.permission.BIND_WALLPAPER"
In the wrong spot, it should be in the service tag, and only have ONE, having multiple will break it.

Categories

Resources