Commit ed4c19ba authored by Philipp Auersperg's avatar Philipp Auersperg

geht auch unter android 6

parent 23d43ac4
......@@ -8,8 +8,8 @@ android {
compileSdkVersion 28
defaultConfig {
applicationId "com.example.androidrpcclient"
minSdkVersion 19
// minSdkVersion 26
// minSdkVersion 19
minSdkVersion 26 //brauchts fuer android 8 fuer startForegroundService
targetSdkVersion 28
versionCode 1
versionName "1.0"
......
......@@ -86,18 +86,21 @@ class MainActivity : AppCompatActivity() {
// intent.putExtra("pythonHome","/data/user/0/org.bd.pureservice/files/app")
// intent.putExtra("pythonPath", "/data/user/0/org.bd.pureservice/files/app:/data/user/0/org.bd.pureservice/files/app/lib")
// intent.putExtra("pythonServiceArgument", "test argument ok")
val pm=getPackageManager()
val res=pm.getPackageInfo("org.bd.pureservice",0)
val prefix = res.applicationInfo.dataDir
intent.putExtra("androidPrivate", "/data/data/org.bd.pureservice/files/app")
intent.putExtra("androidArgument", "/data/data/org.bd.pureservice/files/app")
intent.putExtra("androidPrivate", prefix+"/files/app")
intent.putExtra("androidArgument", prefix+"/files/app")
intent.putExtra("serviceEntrypoint","servp3.py")
intent.putExtra("pythonName","schas")
intent.putExtra("pythonHome","/data/data/org.bd.pureservice/files/app")
intent.putExtra("pythonPath", "/data/data/org.bd.pureservice/files/app:/data/data/org.bd.pureservice/files/app/lib")
intent.putExtra("pythonHome",prefix+"/files/app")
intent.putExtra("pythonPath", "$prefix/files/app:$prefix/files/app/lib")
intent.putExtra("pythonServiceArgument", "test argument ok")
try{
val res=startService(intent)
// val res=startForegroundService(intent)
// val res=startService(intent)
val res=startForegroundService(intent)
} catch (e: Exception) {
txtStatus.text = "Exception"
txtMessage.text = e.toString()
......@@ -105,16 +108,19 @@ class MainActivity : AppCompatActivity() {
}
fun onInstallApk(view: View){
try {
val promptInstall = Intent(Intent.ACTION_VIEW)
.setDataAndType(
Uri.fromFile(File("/sdcard/r2Client-1.1.3a.apk")),
"application/vnd.android.package-archive"
)
startActivity(promptInstall)
} catch (e:Exception) {
txtMessage.text=e.message
}
// try {
// val promptInstall = Intent(Intent.ACTION_VIEW)
// .setDataAndType(
// Uri.fromFile(File("/sdcard/r2Client-1.1.3a.apk")),
// "application/vnd.android.package-archive"
// )
// startActivity(promptInstall)
// } catch (e:Exception) {
// txtMessage.text=e.message
// }
val pm=getPackageManager()
val res=pm.getPackageInfo("org.bd.pureservice",0)
this.txtMessage.text = res.applicationInfo.dataDir
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment