在我活动的 onNewIntent() 方法中, getIntent().getData();
始终为空。onCreate()
在去或任何其他生命周期函数之前肯定会去这个方法。它从浏览器返回这里,但我不知道为什么getIntent().getData()
为空。
这个活动像这样启动浏览器context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(requestToken.getAuthenticationURL())));
并返回这里
@Override
public void onNewIntent(Intent intent){
super.onNewIntent(intent);
Uri uri = getIntent().getData();
if (uri != null && uri.toString().startsWith(TwitterConstants.CALLBACK_URL)) {...}
}
但 uri 始终为空。
清单的东西:
<activity
android:name="myapp.mypackage.TweetFormActivity"
android:configChanges="orientation|keyboardHidden"
android:label="@string/app_name"
android:launchMode="singleInstance"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Black.NoTitleBar">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="oauth" android:host="myapp"/>
</intent-filter>
</activity>
static final String CALLBACK_URL = "oauth://myapp";
我在这里想念什么?谢谢