Question

(post updated for working code)

I've been trying to get my android app to authorize with Twitter and then catch the auth token with a callback URL in my app.

I think I have something wrong in my AndroidManifest.xml though. From what I understand, if I launch my app using android:launchmode="singleTask" then I need to retrieve the AccessToken object in the onResume() method of my main activity.

If I do not specify singleTask launch, then I need to do the retrieval in the onNewIntent() method instead.

I've tried both ways in my manifest file but I'm not getting control in onNewIntent() or onResume(). What happens is Twitter redirects with my callback URL but then the webbrowser just says "Webpage not available". and logcat says:

Tab  E  onReceivedError -10 myapp://www.authtoke.app?oauth_token=2Y3jZMfHZ06Teezzy3l1KvlWqs961tsqXFlTgMHrA&oauth_verifier=PBfCueZLEzEteBoLTksDARQDRi3raVi5FiEJllCYus The protocol is not supported.

anyone know what I've got mucked up? Here's the manifest entries:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.test.twitterLib"
    android:versionCode="1"
    android:versionName="1.0" >

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

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

    <application  android:name=".myAppVars"    android:icon="@drawable/ic_launcher"  android:label="@string/app_name" >
        <activity  android:name=".TwitterLibActivity"  android:label="@string/app_name"  android:launchMode="singleTask">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" > </action>
                <category android:name="android.intent.category.LAUNCHER" ></category>
            </intent-filter>

            <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>
                <data  android:scheme="myapp" android:host="www.authtoke.app"> </data>
            </intent-filter>
        </activity>

    </application>

</manifest>
Was it helpful?

Solution

Found the answer here: androidforums.com/introductions/…. Edited manifest so it works. I moved the VIEW, DEFAULT and BROWSABLE items into a second intent-filter stanza.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top