Please refer to Branch's SDK Documentation for Capacitor.
branchmetrics / capacitor-branch-deep-links Goto Github PK
View Code? Open in Web Editor NEWCapacitor plugin for branch.io deep links
License: MIT License
Capacitor plugin for branch.io deep links
License: MIT License
Please refer to Branch's SDK Documentation for Capacitor.
I have implement deep linking in my ionic capacitor app as we need deferred deep linking. I have everything setup in dashboard.
I am running the app with branch test key and I see every test is passed and branch is setup correctly
When I click deeplink in email or iphone notes app it does opens the app and I see the link which opens the app but I see its not treating the link as branch link
["+clicked_branch_link": 0, "+is_first_session": 0, "+non_branch_link": https://xxx.app.link/ad123zasw?bnc_validate=true]
Because of this deferred deeplinking doesn't work either. I followed the steps
But I don't see context being saved for deeplinking. I have verified that I am using correct branch keys and apple team id.
import { Plugins } from '@capacitor/core';
import { BranchInitEvent } from 'capacitor-branch-deep-links';
const { BranchDeepLinks } = Plugins;
Just paste this: https://help.branch.io/developers-hub/docs/capacitor#initialize-branch
Need to support Capacitor 4+
5.0.0
Doc issue
Doc issue
Please update the doc to Capacitor 4 syntax.
Ref: https://help.branch.io/developers-hub/docs/capacitor#install-branch
In the cordova plugin there is the ability to call the funcion getLatestReferringParams()
and retrieve the latest data branchio received. I haven't found a similar functionality on the capacitor plugin.
Hi
I recently tried to implement Mixpanel and Branch in a Capacitor app, but I couldn't get attribution to work from Branch -> Mixpanel. Mixpanel's docs say that the device id they provide should be sent to Branch in the setRequestMetadata function which is included in the iOS and Android Branch SDKs but not exposed by this library
Branch / Mixpanel docs pertaining to the java/ObjC calls used to make the request: https://help.branch.io/using-branch/page/mixpanel#4-pass-idmetadata-to-branch
The Cordova version of this project includes this function: https://help.branch.io/developers-hub/docs/cordova-phonegap-ionic#link-data-mixpanel-integration
I'm getting tons of Crash Reports in the Google Play console after setting this up on my Ionic App. It seems to be happening the most with Android 10.
java.lang.RuntimeException:
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:6465)
at android.app.ActivityThread.access$1300 (ActivityThread.java:219)
at android.app.ActivityThread$H.handleMessage (ActivityThread.java:1859)
at android.os.Handler.dispatchMessage (Handler.java:107)
at android.os.Looper.loop (Looper.java:214)
at android.app.ActivityThread.main (ActivityThread.java:7356)
at java.lang.reflect.Method.invoke (Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run (RuntimeInit.java:492)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:930)
Caused by: java.lang.IllegalStateException:
at android.app.ContextImpl.getSharedPreferences (ContextImpl.java:458)
at android.app.ContextImpl.getSharedPreferences (ContextImpl.java:443)
at android.content.ContextWrapper.getSharedPreferences (ContextWrapper.java:178)
at io.branch.referral.PrefHelper. (PrefHelper.java:144)
at io.branch.referral.PrefHelper.getInstance (PrefHelper.java:162)
at io.branch.referral.Branch. (Branch.java:424)
at io.branch.referral.Branch.initInstance (Branch.java:797)
at io.branch.referral.Branch.getBranchInstance (Branch.java:613)
at io.branch.referral.Branch.getInstance (Branch.java:669)
at io.branch.referral.BranchApp.onCreate (BranchApp.java:35)
at android.app.Instrumentation.callApplicationOnCreate (Instrumentation.java:1189)
at android.app.ActivityThread.handleBindApplication (ActivityThread.java:6460)
Hi,
Do you have any plan to support the latest Capacitor 4 with Branchio? Thanks!
Announcing Capacitor 4.0
: https://ionicframework.com/blog/announcing-capacitor-4-0/
getting the following errors:
Cannot find type 'BranchQRCode' in scope
Cannot convert value of type '_' to expected argument type 'Stri
both occurring in the branchserice.swift file (of the framework)
expect the project to compile and run
5.0
iphone
13
nothing more to add
On iOS after the last update about setDMAParamsForEEA when I try to build my app in xCode I get this following error
Type 'Branch' has no member 'setDMAParamsForEEA'
1.Try to build any app using the latest version of capacitor-branch-deep-links
No errors
7.1.0
Simulator iPhone 15 Pro
17.2
No response
Thanks so much for this plugin! It's really going to help me out.
I'm confused about what I am going to be putting into the Android URI Scheme and iOS URI Scheme input boxes when using the Capacitor plugin as opposed to the Cordova one?
This screen is found in the Branch Dashboard
Problem
When sending a push notification (in this case via Braze) which hold a deep link on click, if the app in the background, it only opens the application but does not hold any of the referringParams data and shows an error of:
"Warning. Session initialization already happened. To force a new session, set intent extra, "branch_force_new_session", to true."
If you leave the app to go back into background, then foreground it again, it suddenly has the branch data within the object and works as intended. It is on the first push click and app open (if the app has already been opened and is in the background) that it is empty and fails.
Platform
Android
Code
public class MainActivity extends BridgeActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Additional plugins you've installed go here
// Ex: registerPlugin(TotallyAwesomePlugin.class);
registerPlugin(Contacts.class);
registerPlugin(NativeBiometric.class);
registerPlugin(BranchDeepLinks.class);
}
@Override
protected void onNewIntent(Intent intent) {
// super.onNewIntent(intent);
// this.setIntent(intent);
this.setIntent(intent);
super.onNewIntent(intent);
// handles warning:"session initialization already happened"
if(intent != null) {
intent.putExtra("branch_force_new_session", true);
}
}
}
public class CustomApplicationClass extends MultiDexApplication {
@Override
public void onCreate() {
super.onCreate();
// Branch logging for debugging
Branch.enableLogging();
if (SDK_INT >= 24) {
UserManager um = getApplicationContext().getSystemService(UserManager.class);
if (um == null || !um.isUserUnlocked()) return;
}
// Branch object initialization
Branch.getAutoInstance(this);
}
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
}
}
Environment setup
If I set io.branch.sdkTestMode
to true then my app doesn't seem to receive any data when opening a link. All it receives is this:
{"referringParams":{"+clicked_branch_link":false,"+is_first_session":false}}
I've triple checked the keys I'm using, and have set the TestMode meta-data key to true. Anything else I'm missing?
Googling around a bit it seems Branch has had issues with this in the past (2017), but I didn't find anything recent.
I'm still able to develop with the live key. But being able to use the test key would be ideal.
strings.xml
<string name="branch_key">LIVE_KEY</string>
<string name="branch_test_key">TEST_KEY</string>
manifest:
<meta-data android:name="io.branch.sdk.BranchKey" android:value="@string/branch_key" />
<meta-data android:name="io.branch.sdk.BranchKey.test" android:value="@string/branch_test_key" />
<meta-data android:name="io.branch.sdk.TestMode" android:value="true" /> <!-- Set to true to use test key -->
Although it is mentioned that this plugin is working with ios 12
https://github.com/BranchMetrics/capacitor-branch-deep-links/blob/master/ios/Podfile#L1
it may in fact crash on ios 12.
The reason being this line: https://github.com/BranchMetrics/capacitor-branch-deep-links/blob/master/ios/Podfile#L7
In certain cases, and depending on cache, it may install Branch 1.42.0 which is not compatible with ios 3.
We fixed this (after 3 days of working on it...) by adding the Branch 1.4.1 as dependency:
in the ios/App/Podfile:
target 'app' do
capacitor_pods
pod 'Branch', '1.41.0' # add this line to install the pod good verison that works with ios 12.
# Add your Pods here
end
Suggestion - to comply with ios12, the POD version on the above Podfile, the version should be fixed on 1.41.0, as 1.42 is no longer compliant.
Also filed as issue on the Branch framework: BranchMetrics/ios-branch-deep-linking-attribution#1185
When I use cordova-branch, I used createBranchUniversalObject method.
In the capacitor version, can I use it?
const branchObj = await this.createBranchUniversalObject({
canonicalIdentifier,
canonicalUrl,
title,
contentDescription,
contentImageUrl,
contentMetadata
})
Hi When I used "capacitor-branch-deep-links": "5.0.0" in Web.
It is sitll show errors:
Is there an updated answer to this question?
Steps to reproduce
I used "capacitor-branch-deep-links": "5.0.0",
It is sitll show errors:
Expected behavior
Generated right deep link
SDK Version
5.0.0
Make and Model
chrome
OS
chrome
No response
We have added deep-linking integration in our app and using capacitor-branch-deep-links. It is working till iOS 12.1 but in iOS 13+ it does not show a pop-up to open the application on a click of deep-link.
We have also tried forced uri redirect mode but none of these solutions are working.
https://help.branch.io/using-branch/docs/creating-a-deep-link#forced-redirections
Installed Dependencies:
Ionic 5.26.0
@capacitor/cli 2.4.5
@capacitor/core 2.4.5
@capacitor/ios 2.4.5
capacitor-branch-deep-links 3.0.0
when building the app on iOS
▸ Copying Plugin.h
▸ Copying CapacitorBranchDeepLinks-umbrella.h
▸ Processing CapacitorBranchDeepLinks-Info.plist
❌ /app-project/node_modules/capacitor-branch-deep-links/ios/Plugin/BranchService.swift:40:40: cannot find type 'BranchQRCode' in scope
func getBranchQRCode(branchQRCode: BranchQRCode, buo: BranchUniversalObject, linkProperties: BranchLinkProperties, completion: @escaping (String?, Error?)->(Void)) -> Void {
^~~~~~~
❌ /app-project/node_modules/capacitor-branch-deep-links/ios/Plugin/BranchService.swift:46:28: cannot convert value of type '_' to expected argument type 'String?'
completion(qrCodeString,nil)
^~~~~~~~~~~~
⚠️ /app-project/node_modules/capacitor-branch-deep-links/ios/Plugin/Plugin.swift:83:14: 'success()' is deprecated: renamed to 'resolve()'
call.success()
^
⚠️ /app-project/node_modules/capacitor-branch-deep-links/ios/Plugin/Plugin.swift:158:14: 'success()' is deprecated: renamed to 'resolve()'
call.success()
^~~~~~~
❌ /app-project/node_modules/capacitor-branch-deep-links/ios/Plugin/Plugin.swift:253:22: cannot find 'BranchQRCode' in scope
let qrCode = BranchQRCode()
^~~~~~~
❌ /app-project/node_modules/capacitor-branch-deep-links/ios/Plugin/Plugin.swift:272:39: cannot infer contextual base in reference to member 'JPEG'
qrCode.imageFormat = .JPEG
^~~~~~~~~~~~
❌ /app-project/node_modules/capacitor-branch-deep-links/ios/Plugin/Plugin.swift:274:39: cannot infer contextual base in reference to member 'PNG'
qrCode.imageFormat = .PNG
capacitor-branch-deep-links
version 5.0.0 to your capacitor app (capacitor v4)npx cap sync
you should be able to build an app with this plugin latest version on iOS and capacitor 4
5.0.0
any simulator or actual device
ios
No response
A recent update to the SDK has removed the AdServices import, which is breaking iOS builds. Manually setting
pod 'Branch', '1.38.0'
has fixed it for now.
Will capacitor-branch-deep-links
support new version of Capacitor (3.0.0)?
Now build fails when try to build with Capacitor (3.0.0)
https://capacitorjs.com/docs/v3/updating/3-0#ios
As mentioned in Capacitor migrations docs, min version of iOS is 12 now.
Per the readme, I added:
+ @Override
+ protected void onNewIntent(Intent intent) {
+ this.setIntent(intent);
+ super.onNewIntent(intent);
+ }
to my activity, and now I see build errors like:
protected void onNewIntent(Intent intent) {
^
symbol: class Intent
location: class MainActivity
Is the README incomplete? Maybe missing an import statement?
Just went through the Android setup documentation for this plugin, located here: https://help.branch.io/developers-hub/docs/capacitor
I noticed a few discrepancies/opportunities for clarification for someone like me that has no native Android knowledge:
Thought this might be best shared here but let me know if I should send this somewhere else.
Please update the plugin with the latest iOS SDK v1.39.4 and Android SDK v5.0.10
Please refer to [Branch's SDK Documentation for Capacitor](https://help.branch.io/developers-hub/docs/capacitor).
...only links to the current version of documentation. So we lose all history of setup instructions as the v4 ages out and setup changes.
It would better if setup instructions existed in the repo since setup has changed drastically over various versions.
The official branch documentation tells you to install a set of dependencies. As seen in their documentation:
dependencies {
...
// required for all Android apps
implementation 'io.branch.sdk.android:library:5.+'
// required if your app is in the Google Play Store (tip: avoid using bundled play services libs)
implementation 'com.google.firebase:firebase-appindexing:19.0.0'
implementation 'com.google.android.gms:play-services-ads-identifier:16+'
// optional
// Chrome Tab matching (enables 100% guaranteed matching based on cookies)
implementation 'androidx.browser:browser:1.0.0'
// Replace above with the line below if you do not support androidx
// implementation 'com.android.support:customtabs:28.0.0'
...
}
This differs pretty much from what the docs of this library are stating.
Is that intentional? Or is this a mistake?
From the document, there seems to be no way to add contentMetadata in sendBranchEvent, is there any other way?
Not long time ago Google Play started to show message about play-services-ads and play-services-ads-lite versions sunset
This version is scheduled to sunset on June 30th 2023. See https://developers.google.com/admob/android/deprecation for more information.
In documentation version 19.4.0 is specified.
I've tried update it to latest but app is crashing with error
******************
* The Google Mobile Ads SDK was initialized incorrectly. AdMob publishers *
* should follow the instructions here: *
* https://googlemobileadssdk.page.link/admob-android-update-manifest *
* to add a valid App ID inside the AndroidManifest. *
* Google Ad Manager publishers should follow instructions here: *
* https://googlemobileadssdk.page.link/ad-manager-android-update-manifest. *
******************
I see that I have to add AdMob app ID, but I'm not sure what it is, where I shoult get it and does it requred at all.
5.0.0
Xiaomi 10T Pro
Android
No response
The addListener function is not working as a listener meaning that if new refferingParams arrive to App you will have to call again the BranchDeepLinks.addListener function in order to read them.
Just initialize
BranchDeepLinks.addListener("init", (event: BranchInitEvent) => {
console.log("Deep Link branch Data:", event.referringParams);
});
With your app opened and initialized just try Browser.open({url: "your branch url"}). The listener will never detect the new data.
The addListener function should detect new data without the need of calling the function everytime you know new data will arrive. Otherwise the function (addListener) is missnamed and missleading.
7.0.0
Any android
Android 13
No response
Please update documentation at https://help.branch.io/developers-hub/docs/capacitor (and keep version history of it). For example, Android Branch SDK dependency type changed from implementation to api.
P.s. tried to report this as a documentation issue but the button 'Suggest edits' is not on the documentation page :-/
None
None
5
None
None
No response
A Capacitor 5 project with this plugin won't build on android because of the package namespace/id being moved from AndroidManifest.xml to build.gradle. See https://capacitorjs.com/docs/next/updating/plugins/5-0
I received the following information from Branch via Email and I'm wondering if any action will be needed for this plugin. Is there any action that needs to be taken on this end?
A couple of months ago, Google announced that they will stop broadcasting install_referrer intents on March 1, 2020. Branch uses this data to help power our deep linking and attribution services on Android devices.
Fortunately, Google has also introduced the Play Install Referrer API to provide the same data. This API provides better performance, and there is a good chance it is already configured in your app. However, Google has recently contacted several Branch customers about this, so we wanted to proactively reach out and help you confirm your configuration in advance of the cutoff date.
REQUIRED ACTIONS
Branch Android SDK: please do EITHER of the following for your Android app:
OR
TUNE Android SDK: Please update to the most recent version of the SDK (v6.1.2, currently only available on JCenter). The TUNE Android SDK already bundles the Play Install Referrer Library, but older versions contain a rare bug that can cause a background thread to pause for up to 60 seconds while waiting for install_referrer data to be returned.
In addition, we recommend confirming that the following entry has been removed from your AndroidManifest.xml file:
Branch SDK
<receiver android:name="io.branch.referral.InstallListener" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
TUNE SDK
<receiver android:name="com.tune.TuneTracker">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>
If you have any questions, please feel free to reach out to [email protected].
Sincerely,
The Branch Team
Hello!
I've already implemented this plugin and it works perfectly for iOS. For Android, opening branch links works but sharing does not. I am getting a fatal native crash and not sure where to start. I've triple checked all of the implementation steps for Android and it seems like things are in order, but in logcat I see this crash when calling BranchDeepLink.showShareSheet().
Serious error executing plugin
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:99)
at com.getcapacitor.Bridge$1.run(Bridge.java:542)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:214)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources android.app.Activity.getResources()' on a null object reference
at co.boundstate.BranchDeepLinks.getShareSheetStyle(BranchDeepLinks.java:268)
at co.boundstate.BranchDeepLinks.showShareSheet(BranchDeepLinks.java:121)
... 7 more
Any ideas where to start?
ionic info
Ionic:
Ionic CLI : 6.12.3 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.5.1
@angular-devkit/build-angular : 0.1100.3
@angular-devkit/schematics : 10.0.8
@angular/cli : 10.0.8
@ionic/angular-toolkit : 2.3.3
Capacitor:
Capacitor CLI : 2.4.4
@capacitor/core : 2.4.4
Utility:
cordova-res : 0.15.2
native-run : 1.3.0
System:
NodeJS : v10.15.3 (/usr/local/bin/node)
npm : 6.13.4
OS : macOS Big Sur
package.json
"capacitor-branch-deep-links": "^3.0.0",
Can you please clarify this statement in the Android setup documentation.
Declare BranchApp as your application class in src/main/AndroidManifest.xml:
<application
+ android:name="io.branch.referral.BranchApp"
Is android:name supposed too explicitly be "io.branch.referral.BranchApp" or is it supposed to be the name of your specific app? When I enter this in my AndroidManfest.xml file it tells me that it doesn't exist. However, the deep links still work and the app compiles.
I am receiving an undescriptive error message that I'm struggling to debug during init.
I would really appreciate help, thank you.
Here is my AppDelegate.swift
import UIKit
import Capacitor
import Branch
@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
Branch.setUseTestBranchKey(true) // if you are using the TEST key
Branch.getInstance().enableLogging() // enable logging
Branch.getInstance().initSession(launchOptions: launchOptions)
return true
}
func applicationWillResignActive(_ application: UIApplication) {
// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
// Use this method to pause ongoing tasks, disable timers, and invalidate graphics rendering callbacks. Games should use this method to pause the game.
}
func applicationDidEnterBackground(_ application: UIApplication) {
// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}
func applicationWillEnterForeground(_ application: UIApplication) {
// Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
}
func applicationDidBecomeActive(_ application: UIApplication) {
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}
func applicationWillTerminate(_ application: UIApplication) {
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
// Called when the app was launched with a url. Feel free to add additional processing here,
// but if you want the App API to support tracking app url opens, make sure to keep this call
Branch.getInstance().application(app, open: url, options: options)
return ApplicationDelegateProxy.shared.application(app, open: url, options: options)
}
func application(_ application: UIApplication, continue userActivity: NSUserActivity, restorationHandler: @escaping ([UIUserActivityRestoring]?) -> Void) -> Bool {
// Called when the app was launched with an activity, including Universal Links.
// Feel free to add additional processing here, but if you want the App API to support
// tracking app url opens, make sure to keep this call
Branch.getInstance().continue(userActivity)
return ApplicationDelegateProxy.shared.application(application, continue: userActivity, restorationHandler: restorationHandler)
}
override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) {
super.touchesBegan(touches, with: event)
let statusBarRect = UIApplication.shared.statusBarFrame
guard let touchPoint = event?.allTouches?.first?.location(in: self.window) else { return }
if statusBarRect.contains(touchPoint) {
NotificationCenter.default.post(name: .capacitorStatusBarTapped, object: nil)
}
}
func application(_ application: UIApplication, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
NotificationCenter.default.post(name: .capacitorDidRegisterForRemoteNotifications, object: deviceToken)
}
func application(_ application: UIApplication, didFailToRegisterForRemoteNotificationsWithError error: Error) {
NotificationCenter.default.post(name: .capacitorDidFailToRegisterForRemoteNotifications, object: error)
}
func application(_ application: UIApplication, didReceiveRemoteNotification userInfo: [AnyHashable : Any], fetchCompletionHandler completionHandler: @escaping (UIBackgroundFetchResult) -> Void) {
Branch.getInstance().handlePushNotification(userInfo)
}
}
Here is my imports & calling of addListener's as seen in the set up docs
import { BranchDeepLinks, BranchInitEvent } from 'capacitor-branch-deep-links';
console.log("branch.io init begins...")
BranchDeepLinks.addListener('init', (BranchInitEvent) => {
// Retrieve deeplink keys from 'referringParams' and evaluate the values to determine where to route the user
// Check '+clicked_branch_link' before deciding whether to use your Branch routing logic
console.log("branchdeeplinks event init: ", BranchInitEvent);
});
BranchDeepLinks.addListener('initError', (error) => {
console.error("branchdeeplinks initError: ", error);
});
console.log("branch.io init ends...")
Finally, here is my package.json
{
"name": "cardTwister",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"@capacitor-community/firebase-analytics": "^1.0.1",
"@capacitor-community/sqlite": "^3.4.1-3",
"@capacitor/android": "^3.4.3",
"@capacitor/app": "^1.1.1",
"@capacitor/cli": "^3.4.3",
"@capacitor/core": "^3.4.3",
"@capacitor/filesystem": "^1.1.0",
"@capacitor/ios": "^3.4.3",
"@capacitor/splash-screen": "^1.2.2",
"@ionic-native/core": "^5.23.0",
"@ionic-native/google-analytics": "^4.20.0",
"@ionic-native/in-app-purchase": "^5.24.0",
"@ionic-native/in-app-purchase-2": "^5.36.0",
"@ionic-native/keyboard": "^5.35.0",
"@ionic-native/launch-review": "^5.24.0",
"@ionic-native/onesignal": "^5.23.0",
"@ionic-native/screen-orientation": "^5.19.1",
"@ionic/core": "^4.11.7",
"@ionic/vue": "0.0.9",
"@robingenz/capacitor-background-task": "^1.0.1",
"@sentry/browser": "^5.15.5",
"@sentry/integrations": "^5.15.5",
"apollo-boost": "^0.4.9",
"axios": "^0.26.0",
"capacitor-branch-deep-links": "^4.1.1",
"cordova-launch-review": "^4.0.0",
"cordova-plugin-device": "^2.0.3",
"cordova-plugin-ionic-keyboard": "^2.2.0",
"cordova-plugin-purchase": "^10.6.1",
"cordova-plugin-screen-orientation": "^3.0.2",
"core-js": "^3.21.1",
"es6-promise-plugin": "^4.2.2",
"graphql": "^15.5.0",
"jetifier": "^1.6.6",
"onesignal-cordova-plugin": "^2.11.1",
"rxjs": "^7.5.4",
"vue": "^2.6.10",
"vue-apollo": "^3.0.7",
"vue-router": "^3.1.3",
"vue2-touch-events": "^3.2.2",
"vuex": "^3.1.2"
},
"devDependencies": {
"@vue/cli-plugin-babel": "^4.1.0",
"@vue/cli-service": "^4.1.0",
"node-sass": "^4.13.1",
"node-sass-magic-importer": "^5.3.2",
"sass-loader": "^8.0.2",
"vue-sqlite-hook": "^2.0.0-alpha.1",
"vue-template-compiler": "^2.6.10"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"rules": {},
"parserOptions": {
"parser": "babel-eslint"
}
},
"browserslist": [
"> 1%",
"last 2 versions"
]
}
BranchDeepLinks.addListener('init', (event: BranchInitEvent) => {
alert(JSON.stringify(event.referringParams))
//referringParams are empty
})
here is how i generate a shortUrl that contains token
async generateBranchLink() {
try {
let user = await this.storageService.get('user');
var properties = {
$match_duration: 2000,
custom_string: 'data',
custom_boolean: true,
$custom_data: JSON.stringify({token: user.share_token}),
};
let res = await BranchDeepLinks.generateShortUrl({properties});
return res.url;
} catch (err) {
console.error('Error generating Branch link:', err);
throw err;
}
}
1.Implement capacitor-branch-deep-links as per the documentation
2.Generate a deep link with custom user share token
3.Attempt to open the app through the generated deep link.
The app opens via the deep link, but all parameters that were appended to the deep link URL are received as empty. This behavior is consistent across different devices and platforms.
7.1.0
Iphone 12 Pro
iOS 17.3.1
No response
Im trying to implement branch links in my android app. After following every step here
https://help.branch.io/developers-hub/docs/capacitor
Im getting these errors in MainActivity.java class
package co.boundstate does not exist
cannot find symbol class BranchDeepLinks
I'm getting BranchDeepLinks does not have web implementation
when I built a release .apk
from android studio.
But when I just hit run it works perfectly.
Any idea why this is happening with the release builds only.?
Ionic:
Ionic CLI : 6.12.3 (/home/atish/.nvm/versions/node/v14.13.0/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/angular 5.6.5
@angular-devkit/build-angular : 0.1102.10
@angular-devkit/schematics : 10.0.8
@angular/cli : 11.2.10
@ionic/angular-toolkit : 2.3.3
Capacitor:
Capacitor CLI : 2.4.2
@capacitor/core : 2.4.6
Utility:
cordova-res : not installed
native-run (update available: 1.3.0) : 1.2.2
System:
NodeJS : v14.13.0 (/home/atish/.nvm/versions/node/v14.13.0/bin/node)
npm : 6.14.8
OS : Linux 5.8
Hi Mike,
Excellent plugin - extremely well put together. Thanks for sharing.
Quick question. Using latest capacitor 1.3.0, my AndroidManifest.xml already has this:
<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="@string/custom_url_scheme" android:scheme="http"/>
<data android:host="@string/custom_url_scheme" android:scheme="https"/>
</intent-filter>
That looks a lot like the intent-filter the README says to add. Do we really need a new intent filter or should the existing one be modified to include these data attributes?
<data android:scheme="https" android:host="xxxx.app.link" />
<data android:scheme="https" android:host="xxxx-alternate.app.link" />
I have followed the installation instructions found here: https://help.branch.io/developers-hub/docs/capacitor for Android precisely
When trying to run the app on on an emulator in Android Studio, the app will not start (message saying the app "keeps stopping")
I'm met with the following logs:
Then just below is the following:
2022-03-30 09:58:21.551 8066-8066/com.aks.cardTwist E/m.aks.cardTwis: Invalid ID 0x00000000.
2022-03-30 09:58:21.554 8066-8066/com.aks.cardTwist D/AndroidRuntime: Shutting down VM
2022-03-30 09:58:21.557 8066-8066/com.aks.cardTwist E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.aks.cardTwist, PID: 8066
java.lang.RuntimeException: Unable to start activity ComponentInfo{com.aks.cardTwist/com.aks.cardTwister.MainActivity}: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3449)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Caused by: java.lang.IllegalStateException: You need to use a Theme.AppCompat theme (or descendant) with this activity.
at androidx.appcompat.app.AppCompatDelegateImpl.createSubDecor(AppCompatDelegateImpl.java:843)
at androidx.appcompat.app.AppCompatDelegateImpl.ensureSubDecor(AppCompatDelegateImpl.java:806)
at androidx.appcompat.app.AppCompatDelegateImpl.setContentView(AppCompatDelegateImpl.java:693)
at androidx.appcompat.app.AppCompatActivity.setContentView(AppCompatActivity.java:170)
at com.getcapacitor.BridgeActivity.onCreate(BridgeActivity.java:28)
at com.aks.cardTwister.MainActivity.onCreate(MainActivity.java:22)
at android.app.Activity.performCreate(Activity.java:7994)
at android.app.Activity.performCreate(Activity.java:7978)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1309)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3422)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3601)
at android.app.servertransaction.LaunchActivityItem.execute(LaunchActivityItem.java:85)
at android.app.servertransaction.TransactionExecutor.executeCallbacks(TransactionExecutor.java:135)
at android.app.servertransaction.TransactionExecutor.execute(TransactionExecutor.java:95)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2066)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:223)
at android.app.ActivityThread.main(ActivityThread.java:7656)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:592)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:947)
Please update the plugin to support Capacitor 3.0 (https://capacitorjs.com/docs/v3/updating/plugins/3-0)
Have updated my project and am getting errors with this package, especially when importing the plugin into the files now as they are no longer supported via the @capacitor/core plugin import.
node_modules\capacitor-branch-deep-links\android\src\main\java\co\boundstate\BranchDeepLinks.java:5: error: package android.support.annotation does not exist
import android.support.annotation.Nullable;
^
node_modules\capacitor-branch-deep-links\android\src\main\java\co\boundstate\BranchDeepLinks.java:21: error: cannot find symbol
@Nullable
^
symbol: class Nullable
location: class BranchDeepLinks
2 errors
HI there
Having an issue where a deeplink will fire twice (but sometimes even multiple times) after opening a Branch link in iOS. My process is as follows:
As far as I can tell, this does not happen on Android. I'm thinking I have some piece of iOS setup wrong, but I've checked everything against the docs and there is no glaring omission. If I have gone wrong somewhere, what could it be?
After updating to Version 3.0.0 of the capacitor plugin, I always get the following error:
Serious error executing plugin
java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.getcapacitor.PluginHandle.invoke(PluginHandle.java:99)
at com.getcapacitor.Bridge$1.run(Bridge.java:526)
at android.os.Handler.handleCallback(Handler.java:883)
at android.os.Handler.dispatchMessage(Handler.java:100)
at android.os.Looper.loop(Looper.java:237)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.Context android.content.Context.getApplicationContext()' on a null object reference
at io.branch.referral.BranchUrlBuilder.<init>(BranchUrlBuilder.java:56)
at io.branch.referral.BranchShortLinkBuilder.<init>(BranchShortLinkBuilder.java:15)
I adjusted my app like mentioned in the Android setup: https://github.com/BranchMetrics/capacitor-branch-deep-links#android-setup
After adding
activity = getActivity();
to BranchDeepLinks.java it works again
When using plugin v3.0.0 my app crashes on Android with no error messages when calling functions:
I haven't tried some other functions other than those two, so some of the others might crash the app too.
When downgrading to v2.0.0 there are no issues and everything works as expected.
Additional environment information:
I'm aware that is possible to add a custom url image in native plugins, I think it's an important feature for us capacitor users.
Hey @mikejpeters, Branch and a couple of talented contractors we work with are mulling over the idea of investing a bit more in this SDK. Are you open to discussing what it would look like for Branch and our contractors maintaining this SDK moving forward?
If so, shoot me a note at [email protected] and we can talk about this more!
iOS v16.5 physical device.
Have a deep link coming in from Slack
the API call is triggered and I can see the data is returned, but the event listener, whilst triggered, only spits out {}
Physical device: v16.5.1, iphone8
xcode: v14.3.1
capacitor-branch-deep-links: v5.0.0
capacitor: v4.1.1
ios BranchSDK: v2.2.0
branch configuration: test
Branch.setUseTestBranchKey(true)
Status 200 error (null)
{"referringParams":{}}
Expected: that referringParams
is actually populated with the data from the API.
5.0.0
iphone 8
16.5.1
2023-07-18 16:58:33.872399+0100 App[2327:170281] [branch.io] BNCServerInterface.m(413) Debug: Body: {
"ad_tracking_enabled" = 0;
"anon_id" = "30AA3207-5C11-40A9-9B3A-B10DBEB5B0AE";
"app_version" = "1.2.2";
"apple_ad_attribution_checked" = 0;
"apple_testflight" = 1;
"branch_key" = "key_test_xxx";
brand = Apple;
build = 20F75;
cd = {
mv = "-1";
pn = "com.xxx.app";
};
"connection_type" = wifi;
country = US;
"cpu_type" = 16777228;
debug = 0;
"device_carrier" = "--";
environment = "FULL_APP";
"facebook_app_link_checked" = 0;
"first_install_time" = 1668595230650;
"hardware_id" = "xxxxxx";
"hardware_id_type" = "vendor_id";
instrumentation = {
"/v1/install-brtt" = 480;
};
"ios_bundle_id" = "com.xxx.app";
"ios_vendor_id" = "xxxx";
"is_hardware_id_real" = 1;
language = en;
"lastest_update_time" = 1689695896000;
"latest_install_time" = 1689695899141;
"local_ip" = "192.168.1.88";
locale = "en_US";
metadata = {
"skan_time_window" = "5184000.000000";
};
model = "iPhone10,4";
"opted_in_status" = "not_determined";
os = iOS;
"os_version" = "16.5.1";
"previous_update_time" = 1689695896000;
"randomized_bundle_token" = 1209879206964938646;
"randomized_device_token" = 1209879206876611234;
retryNumber = 0;
"screen_dpi" = 2;
"screen_height" = 1334;
"screen_width" = 750;
sdk = "ios2.1.2";
"universal_link_url" = "https://share-test.xxx.com/xxxxxxxxxx";
update = 0;
"uri_scheme" = beetl;
"user_agent" = "Mozilla/5.0 (iPhone; CPU iPhone OS 16_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148";
}
JSON: {
"device_carrier": "--",
"os_version": "16.5.1",
"ios_bundle_id": "com.xxx.app",
"debug": false,
"screen_dpi": 2,
"country": "US",
"is_hardware_id_real": true,
"opted_in_status": "not_determined",
"locale": "en_US",
"anon_id": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"ad_tracking_enabled": false,
"sdk": "ios2.1.2",
"instrumentation": {
"/v1/install-brtt": "480"
},
"uri_scheme": "xxx",
"environment": "FULL_APP",
"metadata": {
"skan_time_window": "5184000.000000"
},
"connection_type": "wifi",
"previous_update_time": 1689695896000,
"retryNumber": 0,
"universal_link_url": "https://share-test.xxx.com/xxxxxxxxxxxxx",
"facebook_app_link_checked": false,
"lastest_update_time": 1689695896000,
"local_ip": "xxx.xxx.xxx.xxx",
"brand": "Apple",
"update": 0,
"cd": {
"pn": "com.xxx.app",
"mv": "-1"
},
"cpu_type": "16777228",
"screen_height": 1334,
"apple_ad_attribution_checked": false,
"model": "iPhone10,4",
"randomized_device_token": "1209879206876611234",
"branch_key": "key_test_xxx",
"user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 16_5_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148",
"first_install_time": 1668595230650,
"hardware_id": "xxxxxxxxxxxxxxxxxxxxxxx",
"os": "iOS",
"hardware_id_type": "vendor_id",
"latest_install_time": 1689695899141,
"randomized_bundle_token": "1209879206964938646",
"screen_width": 750,
"build": "20F75",
"language": "en",
"ios_vendor_id": "xxxxxxxxxxxxxxxxxxxxxxx",
"app_version": "1.2.2",
"apple_testflight": true
}.
2023-07-18 16:58:33.873546+0100 App[2327:170281] [branch.io] BNCNetworkService.m(207) Debug: Network start operation https://api2.branch.io/v1/open.
2023-07-18 16:58:34.067984+0100 App[2327:170282] [branch.io] BNCNetworkService.m(202) Debug: Network finish operation https://api2.branch.io/v1/open 0.195s. Status 200 error (null).
{
"data": "{\"$og_title\":\":raised_hands: xxx\",\"$deeplink_path\":\"path/myPathOfPaths\",\"~creation_source\":0,\"$og_description\":\"xxx\",\"+click_timestamp\":1689695914,\"$og_image_url\":\"xxx\",\"+match_guaranteed\":true,\"$desktop_url\":\"xxx\",\"event_id\":\"99ab03ca-c4da-4e3a-8871-7dbd522439ce\",\"+clicked_branch_link\":true,\"~id\":1209467844585220182,\"+is_first_session\":false,\"~referring_link\":\"xxx\",\"$android_url\":\"xxx\",\"$ios_url\":\"xxx\"}",
"link": "https://share-test.xxx.com/a/key_test_xxxxxxxxxxxxxxxxxx?%24randomized_bundle_token=1209879206964938646",
"randomized_bundle_token": "1209879206964938646",
"randomized_device_token": "1209879206876611234",
"session_id": "1209879232185378735"
}.
2023-07-18 16:58:34.069251+0100 App[2327:170282] [branch.io] BNCServerInterface.m(496) Debug: Server returned: [3d8978b9-c630-4a25-8cf9-4a2b95d3aba4-2023071815] Status: 200; Data: {
data = "{\"$og_title\":\"\xxxxxxxxxxxx\",\"$deeplink_path\":\"path/myPathOfPaths\",\"~creation_source\":0,\"$og_description\":\"xxxxxx\",\"+click_timestamp\":1689695914,\"$og_image_url\":\"xxxxxxxx\",\"+match_guaranteed\":true,\"$desktop_url\":\"xxxxxxxxxxxxxxx\",\"event_id\":\"99ab03ca-c4da-4e3a-8871-7dbd522439ce\",\"+clicked_branch_link\":true,\"~id\":1209467844585220182,\"+is_first_session\":false,\"~referring_link\":\"https://share-test.xxxx.com/xxxxxxxxxx\",\"$android_url\":\"xxxxx\",\"$ios_url\":\"xxxxx\"}";
link = "https://share-test.xxxxxxx.com/a/key_test_xxxxx?%24randomized_bundle_token=1209879206964938646";
"randomized_bundle_token" = 1209879206964938646;
"randomized_device_token" = 1209879206876611234;
"session_id" = 1209879232185378735;
}.
Hi,
It seems still to have the old doc here no? https://help.branch.io/developers-hub/docs/capacitor
i.e. it says Updated 4 months ago
?
So will we have an updated doc soon? Thanks!
As part of the Capacitor 5 upgrade, I switched my Android setup to use Gradle 8. Am unable to compile the project due to incompatibility of this plugin with gradle 8 (works fine with gradle 7.x)
defaultConfig contains custom BuildConfig fields, but the feature is disabled.
Run with --info or --debug option to get more log output.
Run with --scan to get full insights.
The project should build without any errors
5.0.0
Oppo A74
Android 13
Using Android Studio Flamingo | 2022.2.1 Patch 2
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.