0

Eclipse から携帯電話でアプリを起動すると、最初に Launcher が起動し、次にメイン アクティビティが起動します。変数をメイン アクティビティに正常に渡します。ユーザー名がトーストでログに記録されていることを確認します。携帯電話からアプリを直接起動すると、メインのアクティビティに直接移動します。メイン アクティビティは、変数を null として登録します。

このランチャーとまったく同じ機能を実行するテストアプリを作成しました。それらのマニフェストは、アクティビティ名を除いて同一です。そして、そのテストアプリは電話から正しく機能し、Eclipseからインストールすると機能します。

これは本当の頭の体操です。

スターター アクティビティのコードは次のとおりです。

public class SecureAppStarter extends Activity {


TextView report;
WebView input;
Context thisContext = this;
String thisValue, url;

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.starter);
    initialize();


    WebViewClient rclient = new WebViewClient(){
        @Override
        public boolean shouldOverrideUrlLoading(WebView  view, String  url){
            return false;
        }
        @Override
        public void onLoadResource(WebView  view, String  url){ 
            input.getSettings().setJavaScriptEnabled(true);
            input.addJavascriptInterface(new CustomJavaScriptInterface(thisContext), "Android");
        }

        @Override
        public void onPageFinished(WebView view, String url){
            report.setText(""+thisValue);
            if (thisValue!= null){
                Intent passOn = new Intent("arbuckle.app.MainActivity");
                passOn.putExtra("username", thisValue);
                startActivity(passOn);
            }
        }
    };
    rclient.onPageFinished(input, url);
    input.setWebViewClient(rclient);
    input.loadUrl(url);
}


public class CustomJavaScriptInterface {
    Context mContext;

    CustomJavaScriptInterface(Context context) {

        mContext = context;
    }

    public void getValue(String value){
        thisValue = value;
    }
}

private void initialize() {
    report = (TextView) findViewById(R.id.tvViewName);
    input = (WebView) findViewById(R.id.wbWebAuth);
    url = "http://URL.of.data.com";
}
}

そして、ここにマニフェストがあります:

 <application
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name" >
        <activity
            android:name="SecureAppStarter"
            android:label="@string/app_name"
            android:configChanges="keyboardHidden|orientation">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
          <activity
            android:name=".ArbuckleAppActivity"
            android:label="@string/app_name"
            android:configChanges="keyboardHidden|orientation">
            <intent-filter>
                <action android:name="arbuckle.app.ArbuckleAppActivity" />

                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>
    </application>
4

1 に答える 1

0

さて、私はそれを理解しました。

主なアクティビティがランチャーであるアプリのバージョンを何週間もインストール/アンインストールしてきました。明らかに、それは Android キャッシュのどこかに保持され、ランチャーではなくなったにもかかわらず、起動するメイン アクティビティを選択していました。

そのため、アプリを完全にアンインストールしました。そして再インストール。今では動作します。

問題を解決するのではなく、ハッキングしたと思う人はいますか? 今後さらに問題が発生する可能性はありますか?

于 2012-08-27T17:19:16.817 に答える