Closed tojopaul closed 1 year ago
Hello, do you get an error message with this problem?
Hello, do you get an error message with this problem?
No, when share from external app to my app .app gets open, but not getting the shared data.i think the checkSendIntentReceived not triggering
Ionic:
Ionic CLI : 6.20.0 (/usr/local/lib/node_modules/@ionic/cli) Ionic Framework : @ionic/angular 5.8.1 @angular-devkit/build-angular : 12.1.4 @angular-devkit/schematics : 12.1.4 @angular/cli : 12.1.4 @ionic/angular-toolkit : 4.0.0
Capacitor:
Capacitor CLI : 3.2.3 @capacitor/android : 3.4.0 @capacitor/core : 3.4.3 @capacitor/ios : 3.4.3
Utility:
I see. Then maybe it is in the way you call "checkSendIntentReceived()". You have to make sure that it is called whenever your app gets active, not only on startup. Are you experiencing this on iOS or Android? On iOS you need to register an event listener in addition to the plugin-call:
useEffect(() => {
window.addEventListener("sendIntentReceived", () => {
checkIntent();
});
checkIntent();
}, [])
Check 57, where problem was the other way around (plugin method not reached at app startup)!
We are facing this issue in Android right now. We have written code to catch the error, but it is showing empty error message. We are getting the shared data only when the app is closed.
We have written this code in on resume() of platform inside app.component.ts file.
Below we are appending the code:
receivefile(){ SendIntent.checkSendIntentReceived().then(async (result: any) => { if (result) { alert(JSON.stringify(result)) } if (result.url) { console.log(result.url); let resultUrl = decodeURIComponent(result.url); } }).catch(err => { console.error(err); }) }
So if you log a message before calling this method, you will get an output on resuming the app? What does your AndroidManifest.xml look like? Do you have a separate activity on "SendIntentActivity"?
So if you log a message before calling this method, you will get an output on resuming the app? What does your AndroidManifest.xml look like? Do you have a separate activity on "SendIntentActivity"?
yes i am getting the log message before calling this method while resuming the app?
below is my AndroidManifest.xml look like
<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.ang.app">
<application
android:allowBackup="true"
android:icon="@mipmap/ic_new"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_new_round"
android:supportsRtl="true"
android:theme="@style/AppTheme"
android:usesCleartextTraffic="true">
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
android:name="com.ang.app.MainActivity"
android:label="@string/title_activity_main"
android:theme="@style/AppTheme.NoActionBarLaunch"
android:launchMode="singleTask">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" android:host="iiakarnataka.com" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.SEND" />
<action android:name="android.intent.action.SEND_MULTIPLE" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:mimeType="text/plain" />
<data android:mimeType="image/*" />
</intent-filter>
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths"></meta-data>
<meta-data android:name="com.google.firebase.messaging.default_notification_icon" android:resource="@mipmap/ic_new" />
<meta-data
android:name="firebase_messaging_auto_init_enabled"
android:value="false" />
<meta-data
android:name="firebase_analytics_collection_enabled"
android:value="false" />
</provider>
</application>
<!-- Permissions -->
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.INTERNET" />
You need to configure a separate activity pointing to the plugin class "SendIntentActivity". See Android, where this is described. Also, as this is an activity running possibly besides your main activity, don't forget to close it with "finish()".
Thank you @carsten-klaffke . it worked 🤝🙏🏻
Describe the bug The send - intent plugin is successfully working while the application is closed or not in the background . The response is coming while the share process is applied but while the application is working in the background / minimised the share process is failing continuously.