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

请问如何在 capacitor 中使用? #1

Closed
cipchk opened this issue Aug 13, 2019 · 2 comments
Closed

请问如何在 capacitor 中使用? #1

cipchk opened this issue Aug 13, 2019 · 2 comments

Comments

@cipchk
Copy link

cipchk commented Aug 13, 2019

安装

package.json 中指定:

"cordova-plugin-openinstall": "^1.2.3"

android/app/src/main/AndroidManifest.xml 增加以下节点:

<meta-data android:name="com.openinstall.APP_KEY" android:value="xxxx"/>

运行:

ionic cap sync android

会抛出异常:

[info] plugin cordova-plugin-openinstall requires to add 
  <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:scheme="$OPENINSTALL_SCHEME"/>
</intent-filter> to your AndroidManifest.xml to work
[fatal] TypeError: Cannot read property 'replace' of undefined

请问应该如何解决呢?

@wenkiwu
Copy link
Collaborator

wenkiwu commented Aug 13, 2019

请添加技术支持QQ,以便我们跟踪解决问题

@wenkiwu wenkiwu closed this as completed Jul 8, 2020
@wenkiwu
Copy link
Collaborator

wenkiwu commented Jul 9, 2020

安装插件

 npm install cordova-plugin-openinstall

同步到原生平台

 npx cap sync

手动修改:

1、修改 capacitor-cordova-android-plugins module 下的 AndroidManifest.xml 文件,将

<meta-data
   android:name="com.openinstall.APP_KEY"
   android:value="$OPENINSTALL_APPKEY"/>

中的 $OPENINSTALL_APPKEY 修改为 openinstall 为应用分配的 appkey

2、修改 app module 下的 AndroidManifest.xml 文件,将

<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:scheme="@string/custom_url_scheme" />
</intent-filter>

@string/custom_url_scheme 修改为 openinstall 为应用分配的 scheme
或者新增配置

<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:scheme="openinstall为应用分配的appkey" />
</intent-filter>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants