added another api get to find out peer ID

This commit is contained in:
2021-12-16 19:22:28 +04:00
parent 840bc4962b
commit fd72ccf6b6
4 changed files with 42 additions and 8 deletions

View File

@@ -7,11 +7,11 @@
<deviceKey>
<Key>
<type value="VIRTUAL_DEVICE_PATH" />
<value value="$USER_HOME$/.android/avd/Pixel_5_API_30.avd" />
<value value="$USER_HOME$/.android/avd/Pixel_XL_API_28.avd" />
</Key>
</deviceKey>
</Target>
</targetSelectedWithDropDown>
<timeTargetWasSelectedWithDropDown value="2021-12-13T04:49:22.926537Z" />
<timeTargetWasSelectedWithDropDown value="2021-12-15T21:48:33.668498Z" />
</component>
</project>

View File

@@ -23,6 +23,7 @@
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" tools:node="replace"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
</manifest>

View File

@@ -40,7 +40,7 @@ class MainActivity : AppCompatActivity() {
Mobile.mobileMain(this.filesDir.absolutePath)
val queue = Volley.newRequestQueue(this)
val url = "http://127.0.0.1:5125/status"
val url = "http://127.0.0.1:5125/account/info"
@@ -51,10 +51,32 @@ class MainActivity : AppCompatActivity() {
//val connectionLabel = findViewById<View>(R.id.PeernetInfo) as TextView
// Display the first 500 characters of the response string.
// textView.text = "Response is: ${response.substring(0, 500)}"
//connectionLabel.text= "Response is: ${response.substring(0, 500)}"
val connectionLabel1 = findViewById<View>(R.id.PeernetInfo1) as TextView
connectionLabel1.text = response.toString()
// Log.d("myTag", "Response is: ${response.substring(0, 500)}");
},
Response.ErrorListener { errorresponse ->
val connectionLabel1 = findViewById<View>(R.id.PeernetInfo1) as TextView
connectionLabel1.text = errorresponse.toString()
Log.d("myTag", errorresponse.toString());
})
// Add the request to the RequestQueue.
queue.add(stringRequest)
val url1 = "http://127.0.0.1:5125/status"
val stringRequest1 = StringRequest(
Request.Method.GET, url1,
Response.Listener<String> { response ->
//val connectionLabel = findViewById<View>(R.id.PeernetInfo) as TextView
// Display the first 500 characters of the response string.
// textView.text = "Response is: ${response.substring(0, 500)}"
//connectionLabel.text= "Response is: ${response.substring(0, 500)}"
val connectionLabel = findViewById<View>(R.id.PeernetInfo) as TextView
connectionLabel.text = response.toString()
// Log.d("myTag", "Response is: ${response.substring(0, 500)}");
// Log.d("myTag", "Response is: ${response.substring(0, 500)}");
},
Response.ErrorListener { errorresponse ->
val connectionLabel = findViewById<View>(R.id.PeernetInfo) as TextView
@@ -62,13 +84,13 @@ class MainActivity : AppCompatActivity() {
Log.d("myTag", errorresponse.toString());
})
// Add the request to the RequestQueue.
queue.add(stringRequest)
queue.add(stringRequest1)
// run("http://127.0.0.1:5125/status")
requestAppPermissions();
// requestAppPermissions();
//Mobilecore.mobileCoreStart()
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {

View File

@@ -15,6 +15,17 @@
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.423" />
app:layout_constraintVertical_bias="0.144" />
<TextView
android:id="@+id/PeernetInfo1"
android:layout_width="217dp"
android:layout_height="245dp"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0.701" />
</androidx.constraintlayout.widget.ConstraintLayout>