Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android app does not reconise plugin ConfigActivity #1676

Closed
cbeuw opened this issue Mar 13, 2018 · 3 comments
Closed

Android app does not reconise plugin ConfigActivity #1676

cbeuw opened this issue Mar 13, 2018 · 3 comments

Comments

@cbeuw
Copy link

cbeuw commented Mar 13, 2018

Environment

  • Android version: 8.0.0
  • Device: Emulated Google Pixel
  • Shadowsocks version: 4.5.1, plugin library 0.1.0

What did you do?

Trying to port GoQuiet to Android. I chose to create a Configuration Activity for preferences.

This is my AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.github.shadowsocks.plugin.gq_client">

    <application
        tools:replace="android:theme"
        android:allowBackup="false"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme" >
        <provider android:name=".BinaryProvider"
            android:exported="true"
            android:authorities="com.github.shadowsocks.plugin.gq_client.BinaryProvider">
            <intent-filter>
                <action android:name="com.github.shadowsocks.plugin.ACTION_NATIVE_PLUGIN"/>
            </intent-filter>
            <intent-filter>
                <action android:name="com.github.shadowsocks.plugin.ACTION_NATIVE_PLUGIN"/>
                <data android:scheme="plugin"
                    android:host="com.github.shadowsocks"
                    android:pathPrefix="/gq-client"/>
            </intent-filter>
            <meta-data android:name="com.github.shadowsocks.plugin.id"
                android:value="gq-client"/>
            <meta-data android:name="com.github.shadowsocks.plugin.default_config"
                android:value="dummy=default;plugin=options"/>
        </provider>
        <activity android:name=".ConfigActivity" >
            <intent-filter>
                <action android:name="com.github.shadowsocks.plugin.ACTION_CONFIGURE"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <data android:scheme="plugin"
                    android:host="com.github.shadowsocks"
                    android:path="/gq_client"/>
            </intent-filter>
        </activity>
    </application>

</manifest>

My ConfigActivity.kt (WIP. At this stage I basically copied everything from simple-obfs-android and translated the syntax to Kotlin (which I don't know)):

package com.github.shadowsocks.plugin.gq_client

import android.os.Bundle
import com.github.shadowsocks.plugin.PluginOptions
import com.github.shadowsocks.plugin.ConfigurationActivity
import android.support.v7.widget.Toolbar
import android.view.MenuItem

class ConfigActivity : ConfigurationActivity(),Toolbar.OnMenuItemClickListener {
    private val child = getFragmentManager().findFragmentById(R.id.content) as ConfigFragment
    private var oldOptions = PluginOptions()
    
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_config)
        val toolbar = findViewById<Toolbar>(R.id.toolbar) as Toolbar
        toolbar.setTitle(getTitle())
        toolbar.setNavigationIcon(R.drawable.ic_navigation_close)
        toolbar.setNavigationOnClickListener(
                fun (_){
                    onBackPressed()
                })
        toolbar.inflateMenu(R.menu.menu_config)
        toolbar.setOnMenuItemClickListener(this)
    }
    override fun onInitializePluginOptions(options: PluginOptions) {
        oldOptions = options
        child.onInitializePluginOptions(options)
    }

    override fun onMenuItemClick(item: MenuItem): Boolean {
        when (item.getItemId()){
            R.id.action_apply -> {
                saveChanges(child.options)
                finish()
                return true
            }
            else -> return false
        }
    }
}

In the Shadowsocks app, my app can be selected as a plugin, but when I click configure, my ConfigActivity is not shown, but a text dialog instead (like kcp-tun).

@cbeuw
Copy link
Author

cbeuw commented Mar 13, 2018

android:path="/gq_client"

should have been

android:path="/gq-client"

That was rather stupid

I want to kms

@cbeuw cbeuw closed this as completed Mar 13, 2018
@Mygod
Copy link
Contributor

Mygod commented Mar 13, 2018 via email

@Mygod
Copy link
Contributor

Mygod commented Apr 10, 2018

Hey @cbeuw could you test if this app with #1742 works on your device?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants