React Native Deep Linking Application Not Opening - android

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.

Related

react native android ask camera permission when user first logs in

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');
}

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.

Android file Webview Download

I am a novice and just to avoid running into difficulties, I created an app with a simple webview function that displays an external site, so that when I have to make a change, I go to the site and update the app as well.
The problem is that if I attach a file on the site (even a simple pdf) from the app it is not possible to download it despite having put the download permissions. Is there a way to "enable" all downloads from the app related to a site domain?
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_DOWNLOAD_MANAGER"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:roundIcon="#mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="#style/AppTheme">
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
It seems that you gave the correct permissions in your Manifest, so the issue must be in the Java code. Since you didn't attach it: you should have a webView.setDownloadListener() method. This question is really similar to yours and might be helpful:
Download file inside WebView
Please attach Java code for a more specific answer.

GCM notification is not receiving when app is killed( not force kill)

I am happily receiving notifications when app is in background and foreground but when app is killed, I am not receiving notifications in some phones (like Xiaomi model phones eg mi3, etc.)
GCM message 0:1434141725194227%03b66390f9fd7ecd
broadcast intent callback: result=CANCELLED forIntent { act=com.google.android.c2dm.intent.RECEIVE pkg= (has extras) }
Although I am getting notifications in other phones like nexus, samsung, others.
Did anyone also had similar problem?
Can someone explain me where I am wrong.
Here is my Manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="<package_name>">
<permission android:name="<package_name>.permission.C2D_MESSAGE" android:protectionLevel="signature"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="<package_name>.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.GET_TASKS" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.CAMERA" />
<uses-permission android:name="android.permission.FLASHLIGHT" />
<action android:name="android.net.wifi.WIFI_STATE_CHANGED"/>
<action android:name="android.net.wifi.STATE_CHANGE"/>
<application
android:name="<package_name>.ApplicationSingleton"
android:allowBackup="true"
android:icon="#mipmap/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme">
<activity
android:name="<package_name>.ui.activity.ReferralActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<receiver
android:name="<package_name>.gcm.GcmBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<category android:name="<package_name>" />
</intent-filter>
<intent-filter>
<action android:name="com.google.android.c2dm.intent.REGISTRATION"/>
<category android:name="<package_name>"/>
</intent-filter>
</receiver>
<service android:name="<package_name>.gcm.GcmIntentService" />
</activity>
<meta-data
android:name="com.google.android.gms.version"
android:value="#integer/google_play_services_version" />
</application>
Autostart probably the best MIUI feature that doesn’t come enabled by default, but should.
What does autostart do? It basically starts the apps you select when the phone starts, so you never miss any notifications or updates.
To enable autostart for your apps, follow the steps below:
Tap on the Security app from the app screen.
You will not find this if you enter from the Settings menu, you have to tap directly on the app icon.
Open Security App:
Once in the Security app, tap on Permissions.
Tap on Autostart
Toggle the apps you want to enable Autostart for
Reboot your phone.
Now you are all set up with autostart!

On Android emulator, trying to load a webview i get net::err_cache_miss

I tried the example shown on Android developers website to show a webpage on a WebView component without success. The emulator shows the following error:
Webpage not available the webpage at http://developer.android.com
could not be loaded because: net::ERR_CHACHE_MISS
I could not find any solution so far, even after looking on other threads on the web. I have also tried different links.
I do not know if could be helpful in understanding the cause of this error, but the emulator is Nexus 4 API 21 with Android 5.0.1. I am using Android Studio 1.0.
The code is the same of the example:
In MainActivity.java:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
WebView myWebView = (WebView) findViewById(R.id.webview);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
myWebView.loadUrl("http://developer.android.com/");
}
In AndroidManifest:
<application
android:allowBackup="true"
android:icon="#drawable/ic_launcher"
android:label="#string/app_name"
android:theme="#style/AppTheme" >
<uses-permission android:name="android.permission.INTERNET" />
.....
And in the view I have added the same code of the example
Example is on:
http://developer.android.com/guide/webapps/webview.html
Exactly, It has occured to me once and the solution was to put the following line: <uses-permission android:name="android.permission.INTERNET"/>
before the <application tag in the manifest.xml file.
Either that line is missing or it's misplaced (eg. at the end of the </manifest> tag.
In case anyone else encounters this problem and since there isn't an answer here I thought I'd provide one.
For me it turned out to simply be the order the tags were in the manifest file. The user-permission element needs to appear before the application element. I just put it directly under the manifest element at the top and that seemed to do the trick for me.
I had the same error and I fixed with
inside the activity, like this:
<activity
android:name=".MainActivity"
android:label="#string/app_name" >
<uses-permission android:name="android.permission.INTERNET" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
Because I build inside the main activity the webView....
I hope this will help someone else.
Actually, the place of tag matters here.
For example, this doesn't work:
<activity android:name=".MainActivity"
android:label="#string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<uses-permission android:name="android.permission.INTERNET" />
</activity>
But below code works perfectly.
<activity android:name=".MainActivity"
android:label="#string/app_name" >
<uses-permission android:name="android.permission.INTERNET" />
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
Just include these Permissions in your AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
Please paste the following outside the application tag in the AndroidManifest.xml
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.CHANGE_NETWORK_STATE"/>
<uses-permission android:name="android.permission.android.permission.ACCESS_NETWORK_STATE"/>

Categories

Resources