Android Java + MetaMask: Send createGiftNative contract call on BSC with custom data and return txHash — no in-app browser

Android Java + MetaMask: Send createGiftNative contract call on BSC with custom data and return txHash — no in-app browser

Manage alerts

Loading saved threads...

ali · External communityPost link
External question — Ethereum Stack Exchange Author: ali Original post: https://ethereum.stackexchange.com/questions/172416 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I have a native Android app (Java) with one button. I want: User taps Pay MetaMask opens directly (no browser, no webpage) User confirms this contract call: function createGiftNative( bytes32 secretHash, uint256 cardAmount, uint256 feeAmount ) external payable returns (bytes32) txHash (or error) returns to my app Problem: Direct Deeplink only sends simple transfers — no custom data metamask.app.link/dapp/... opens a webpage inside MetaMask — I don't want that Old @metamask/sdk is deprecated MetaMask Connect supports eth_sendTransaction with data and returns txHash, but it's JavaScript only — no native Java SDK WalletConnect works but I prefer a MetaMask-native path Question: What is the correct way in 2025 for a native Android Java app to: call a contract function with data, get txHash back in the app, without opening any browser? Is WebView + MetaMask Connect JS the only official path? If yes, what's the minimal implementation?
Quote
Report

Post Reply

Quoted from Forex.com.bd-Editorial External question — Ethereum Stack Exchange Author: ali Source score (net votes, not local likes): 0 Original post: https://ethereum.stackexchange.com/questions/172416 License: CC BY-SA 4.0 — https://creativecommons.org/licenses/by-sa/4.0/ Adaptation: HTML converted to plain text; contact email addresses removed. I have a native Android app (Java) with one button. I want: User taps Pay MetaMask opens directly (no browser, no webpage) User confirms this contract call: function createGiftNative( bytes32 secretHash, uint256 cardAmount, uint256 feeAmount ) external payable returns (bytes32) txHash (or error) returns to my app Problem: Direct Deeplink only sends simple transfers — no custom data metamask.app.link/dapp/... opens a webpage inside MetaMask — I don't want that Old @metamask/sdk is deprecated MetaMask Connect supports eth_sendTransaction with data and returns txHash, but it's JavaScript only — no native Java SDK WalletConnect works but I prefer a MetaMask-native path Question: What is the correct way in 2025 for a native Android Java app to: call a contract function with data, get txHash back in the app, without opening any browser? Is WebView + MetaMask Connect JS the only official path? If yes, what's the minimal implementation?

Cancel quote

Checking account access…