OAuth mit Geocaching API

  • Hi Leute,


    ich habe ein riesiges Problem mit OAuth und der geocaching API. Trotz tage langen suchens bekomme ich es einfach nicht. Ich möchte eine Activity die per Oauth geocaching.com die Auhtentifizierung macht. Ich habe im Internet verschiedene Ansätze gefunden die ich aber nicht in die WebView Activity umsetzen konnte. Kann mir jemanden den SourceCode "GcApiLogin Activity mit WebView" (siehe Code weiter unten) mit Leben füllen, so daß die OAuth bei geocaching.com funktioniert?



    Das wäre toll.




    Vielen Dank im voraus


    // Manifest


    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="de.tektom"
    android:versionCode="1"
    android:versionName="1.0" >


    <uses-sdk android:minSdkVersion="8" />


    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>


    <application
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name" >
    <activity
    android:name=".main"
    android:label="@string/app_name" >
    <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>
    </activity>
    <activity android:name=".GcApiLogin">
    <intent-filter>
    <action android:name="android.intent.action.VIEW"></action>
    <category android:name="android.intent.category.DEFAULT"></category>
    <category android:name="android.intent.category.BROWSABLE"></category>
    </intent-filter>
    </activity>
    </application>
    </manifest>


    //
    // Main Activity
    //


    import android.app.Activity;
    import android.content.Intent;
    import android.os.Bundle;


    public class main extends Activity
    {
    public void onCreate(Bundle savedInstanceState)
    {
    super.onCreate(savedInstanceState);


    setContentView(R.layout.main);


    Intent gcApiLogin = new Intent().setClass(this, GcApiLogin.class);
    this.startActivityForResult(gcApiLogin, 987654321);
    }
    }



    //
    // GcApiLogin Activity mit WebView
    //
    import android.app.Activity;
    import android.app.ProgressDialog;
    import android.graphics.Bitmap;
    import android.graphics.Color;
    import android.os.Bundle;
    import android.view.View;
    import android.view.ViewParent;
    import android.webkit.WebView;
    import android.webkit.WebViewClient;


    public class GcApiLogin extends Activity
    {
    private static GcApiLogin gcApiLogin;
    private static ProgressDialog pd;
    private static boolean pdIsShow = false;


    public void onCreate(Bundle savedInstanceState)
    {
    super.onCreate(savedInstanceState);


    setContentView(R.layout.gcapilogin);
    gcApiLogin = this;



    if (!pdIsShow)
    {
    pd = ProgressDialog.show(gcApiLogin, "", "Loading....", true);
    pdIsShow = true;
    }


    View titleView = getWindow().findViewById(android.R.id.title);
    if (titleView != null)
    {
    ViewParent parent = titleView.getParent();
    if (parent != null && (parent instanceof View))
    {
    View parentView = (View) parent;
    parentView.setBackgroundColor(Color.BLACK);
    }
    }


    final WebView webView = (WebView) this.findViewById(R.id.gal_WebView);


    webView.setWebViewClient(new WebViewClient()
    {


    @Override
    public void onPageStarted(WebView view, String url, Bitmap favicon)
    {
    gcApiLogin.setTitle("Loading...");


    if (!pdIsShow)
    {
    pd = ProgressDialog.show(gcApiLogin, "", "Loading....", true);
    pdIsShow = true;
    }


    super.onPageStarted(view, url, favicon);
    }


    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url)
    {


    return true;
    }


    @Override
    public void onPageFinished(WebView view, String url)
    {
    if (pd != null) pd.dismiss();
    pdIsShow = false;
    }


    });
    }


    }

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!