gpt4 book ai didi

Ionic web intent failing SDK 30+?(Ionic Web意图未能通过SDK 30+?)

转载 作者:bug小助手 更新时间:2023-10-24 17:54:57 27 4
gpt4 key购买 nike



While sharing web-intent from one ionic capacitor app to another ionic capacitor app using https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent/
for SDK 30 and above it is throwing "Error" without any other explanation. Please find sample code in comments

当使用SDK30及以上版本的https://github.com/darryncampbell/darryncampbell-cordova-plugin-intent/将网络意图从一个离子电容器应用程序分享到另一个离子电容器应用程序时,它抛出了“错误”,没有任何其他解释。请在评论中找到示例代码


Steps to reproduce:
Download the code base in comment, build app for : -

复制步骤:在评论中下载代码库,为以下内容构建应用程序:-


varable gradle file :-

可变Gradle文件:-


  compileSdkVersion = 32
targetSdkVersion = 32
androidxActivityVersion = '1.2.0'
androidxAppCompatVersion = '1.2.0'
androidxCoordinatorLayoutVersion = '1.1.0'
androidxCoreVersion = '1.3.2'
androidxFragmentVersion = '1.3.0'
coreSplashScreenVersion = '1.0.0-rc01'
androidxWebkitVersion = '1.4.0'
junitVersion = '4.13.1'
androidxJunitVersion = '1.1.2'
androidxEspressoCoreVersion = '3.3.0'
cordovaAndroidVersion = '7.0.0'```


Android Manifest file :-
`<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.ionic.starter">

<permission android:name="android.permission.QUERY_ALL_PACKAGES" />

<queries>

<package android:name="com.gameplay.app1" />
<package android:name="com.google.android.apps.youtube" />
<package android:name="com.google.android.youtube" />
<package android:name="com.android.twitter" />
<package android:name="com.flipkart.android" />
<package android:name="com.google.android.apps.youtube.music" />
<package android:name="com.google.android.gms.maps" />
<package android:name="com.google.android.gm" />
<package android:name="com.facebook.katana" />
<intent>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="https" />
</intent>
<intent>
<action android:name="android.intent.action.DIAL" />
<data android:scheme="tel" />
</intent>
<intent>
<action android:name="android.intent.action.SEND" />
<data android:mimeType="*/*" />
</intent>
</queries>


<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:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
android:name="io.ionic.starter.MainActivity"
android:label="@string/title_activity_main"
android:theme="@style/AppTheme.NoActionBarLaunch"
android:launchMode="singleTask"
android:exported="true">

<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="com.darryncampbell.cordova.plugin.intent.ACTION"/>
<category android:name="android.intent.category.DEFAULT"/>
</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" />
<data android:mimeType="*/*" />
</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>
</provider>
</application>

<!-- Permissions -->

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_SYNC_SETTINGS"/>
<uses-permission android:name="android.permission.USE_FULL_SCREEN_INTENT"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.LAUNCH_MULTI_PANE_SETTINGS_DEEP_LINK"/>

</manifest>


Related Sample code:

相关示例代码:


 const options = {
action: this.webIntent.ACTION_VIEW,
url: 'http://www.google.com'
};
this.webIntent.startActivity(options).then(
intent => { console.log('Web Intent was successful', intent); },
error => { console.log('Error, Web Intent failed', error);
console.log('Error, Web Intent failed', error); });


Above code works & opens browser but i am unable to open any app & send data to it, be it custom or google app eg : -

上面的代码可以工作并打开浏览器,但我无法打开任何应用程序并向其发送数据,无论是自定义应用程序还是谷歌应用程序,例如:



const options: IntentOptions = {
// action: this.webIntent.ACTION_SEND,
component: {
package: 'com.gameplay.app1',
class: 'com.gameplay.app1.MainActivity'
},
extras: {
launchingAppPackage: 'io.ionic.starter',
launchingAppClass: 'io.ionic.starter.MainActivity'
}
};

this.webIntent.startActivity(options).then(
intent => { console.log('Web Intent was successful', intent); },
error => { console.log('Error, Web Intent failed', error); }
);
***
OR
***
const options = {
action: this.webIntent.ACTION_SEND,
url: 'geo:23.5264055,148.1594006',
package: 'com.google.android.gms.maps'
};
this.webIntent.startActivity(options).then(
() => { console.log('Intent Launched'); },
(e) => { console.log('Intent Error', e); }
);

更多回答

Sample code at (please remove space after :// ) https:// bit.ly/3aopyog

(请删除://之后的空格)https://bit.ly/3aopyog上的示例代码

use this plugin: github.com/carsten-klaffke/send-intent

使用此插件:githorb.com/carsten-klaffke/end-intent

Hi @NajamUsSaqib do you have any sample code for sending & receiving text intents?

您是否有用于发送和接收文本意图的示例代码?

what you mean by sample code? example code is already in plugin repo.

您所说的示例代码是什么意思?示例代码已经在插件库中。

i saw the example code, it is only for receiving the intent. I did not find example of sending the intent

我看到了示例代码,它只用于接收意图。我没有找到发送意向的例子

优秀答案推荐

To fix this issue, I upgraded to ionic 6 & sdk 33.
And in AndroidManifest.xml included the the tag with the package names of the apps to which we need to share the intent

为了解决这个问题,我升级到了Ionic 6&SDK 33。在androidManifest.xml中,包含了带有我们需要与其共享意图的应用程序包名称的标记


更多回答

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com