Skip to content

Commit

Permalink
improve android example: remove second activity launcher and fix the …
Browse files Browse the repository at this point in the history
…manifest (#1052)
  • Loading branch information
radetsky committed Aug 16, 2024
1 parent f136bbf commit e84a7d2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
16 changes: 8 additions & 8 deletions docs/examples/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,26 @@
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:extractNativeLibs="true"
android:theme="@style/AppTheme">

<!-- Main launcher activity -->
<activity android:name=".MainActivitySecureCell"
android:label="@string/app_name"
android:exported="true"> <!-- Specify android:exported attribute with an explicit value -->

android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>

<!-- Secondary activity -->
<activity android:name=".MainActivitySecureMessage"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- No launcher intent filter here -->
</activity>

</application>

</manifest>

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.cossacklabs.themis.android.example

import android.content.Intent
import android.os.Bundle
import android.util.Base64
import android.util.Log
Expand All @@ -18,6 +19,9 @@ class MainActivitySecureCell : AppCompatActivity() {
} catch (e: Exception) {
e.printStackTrace()
}

// Call the second activity
openSecondActivity()
}

private fun encryptDataForStoring() {
Expand All @@ -33,4 +37,9 @@ class MainActivitySecureCell : AppCompatActivity() {
val decryptedData = String(unprotected, charset)
Log.d("SMC", "decrypted data = $decryptedData")
}

private fun openSecondActivity() {
val intent = Intent(this, MainActivitySecureMessage::class.java)
startActivity(intent)
}
}

0 comments on commit e84a7d2

Please sign in to comment.