How you can ship lightning fee request to lnurl from Android app with additional remark knowledge?

on

|

views

and

comments


The fantastic of us at Alby helped resolve this ->

First, add question intent to manifest:

<queries>
    <intent>
        <motion android:title="android.intent.motion.VIEW" />
        <knowledge android:scheme="lightning" />
    </intent>
</queries>

Second, question getalby.com for encoded lnurl:

val requestUrl = "https://getalby.com/lnurlp/bitanon/callback?quantity=1000000&remark=good day" // quantity is in millisats
val consumer = OkHttpClient() 
val request = Request.Builder().url(requestUrl).construct() 
val response = consumer.newCall(request).await()

Third, parse json response for ‘pr’ which comprises encoded lnurl.

Fourth, ship Lightning PayRequest Android Intent, which can open with machine lightning pockets of your alternative:

val intent = Intent(Intent.ACTION_VIEW).apply {
    knowledge = Uri.parse("lightning:$lnurl")
}
if (intent.resolveActivity(packageManager) != null) {
    startActivity(intent)
}

Fifth, parse and deal with extra response information, similar to transaction verification url and so on.

Share this
Tags

Must-read

Waymo raises $16bn to gas international robotaxi enlargement | Know-how

Self-driving automobile firm Waymo on Monday stated it raised $16bn in a funding spherical that valued the Alphabet subsidiary at $126bn.Waymo co-chief executives...

Self-driving taxis are coming to London – ought to we be anxious? | Jack Stilgoe

At the top of the nineteenth century, the world’s main cities had an issue. The streets had been flooded with manure, the unintended...

US regulators open inquiry into Waymo self-driving automobile that struck youngster in California | Expertise

The US’s federal transportation regulator stated Thursday it had opened an investigation after a Waymo self-driving car struck a toddler close to an...

Recent articles

More like this

LEAVE A REPLY

Please enter your comment!
Please enter your name here