Firebase user: isEmailVerified returns false - android

I'm developing an Android app that uses Firebase Authentication. After creating a new user, I'm sending a verification email.
Firebase.auth.currentUser?.let {user ->
user.sendEmailVerification().addOnCompleteListener {verificationTask ->
if(verificationTask.isSuccessful){
_verificationSuccess.value = true
} else {
_verificationError.value = verificationTask.exception
}
}
}
In my manifest, I added an Intent filter that opens my app when the user tries to open the verification link.
<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:host="test-project.firebaseapp.com"
android:scheme="https"/>
</intent-filter>
The problem is that, when the link opens my app, the email is not verified. I have this validation that always returns false
if(Firebase.auth.currentUser.isEmailVerified){
//Email verified
} else {
throw Exception("Email not verified")
}
Only when the verification link is opened in the web explorer, the validation returns true. How can I verify the email inside my app?

By applying the intent filter you have, you've told Android that you will handle all web requests that target https://test-project.firebaseapp.com. Now that your application has trapped browsing to this URL, you now need to make the request to the server on the user's behalf.
By default, when you send an email verification off to the user, they will receive an email with a link that looks like:
https://<PROJECT_ID>.firebaseapp.com/__/auth/action?mode=verifyEmail&oobCode=<VERIFICATION_CODE>&apiKey=<API_KEY>&lang=<LANGUAGE>
Note: These links can be customized using custom action handlers or you could make use of dynamic links so that you don't intercept everything headed for https://test-project.firebaseapp.com.
Because a user may wish to visit your app's website in a browser, you should make your intent filter more specific to just handling email actions.
<intent-filter android:label="#string/filter_view_handle_action_code">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https"
android:host="test-project.firebaseapp.com"
android:pathPrefix="/__/auth/action" />
</intent-filter>
Disclaimer: I haven't tested if the below method works, but in theory it should.
If you intercept such a URL, you need to handle it in the onCreate method:
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
Intent intent = this.getIntent();
if (intent.hasCategory(android.intent.category.BROWSABLE)) {
// intent came from browser
Uri data = intent.getData();
String mode = data.getQueryParameter("mode");
String oobCode = data.getQueryParameter("oobCode");
if (mode != "verifyEmail" || oobCode == null) {
Log.i("MyActivity", "Started with unexpected browsable intent");
return;
}
handleVerifyEmailActionCode(oobCode);
}
}
private handleVerifyEmailActionCode(String oobCode) {
String email = null;
FirebaseAuth.getInstance().checkActionCode(oobCode)
.onSuccessTask( actionCodeResult -> {
if (actionCodeResult.getOperation() != ActionCodeResult.VERIFY_EMAIL) {
throw new UnsupportedActionCodeOperationException(actionCodeResult.getOperation());
}
email = actionCodeResult.getInfo().getEmail();
return FirebaseAuth.getInstance().applyActionCode(oobCode);
})
.addOnCompleteListener( applyActionCodeTask -> {
if (!applyActionCodeTask.isSuccessful()) {
Exception ex = applyActionCodeTask.getException();
// TODO: Handle exceptions
Toast.makeText(getApplicationContext(), "Failed to verify email. " + ex.getMessage(), Toast.LENGTH_SHORT).show();
return;
}
// email verified successfully!
// do something interesting
Toast.makeText(getApplicationContext(), email + " was verified!", Toast.LENGTH_SHORT).show();
FirebaseUser user = FirebaseAuth.getCurrentUser(); // WARN: May not have finished initializing yet?
if (user != null && user.getEmail() == email) {
user.reload()
.addOnFailureListener(ex -> {
Log.e(MyActivity.class, "Failed to refresh user token: " + ex.getMessage());
});
} else {
Log.i(
MyActivity.class,
user == null
? "User wasn't signed in, skipping reload"
: "User email mismatch, skipping reload"
);
}
});
}
/**
* Custom exception to be used when a OOB code's `ActionCodeResult.Operation`
* doesn't match what it was expected to be.
*
* #see https://firebase.google.com/docs/reference/android/com/google/firebase/auth/ActionCodeResult#constant-summary
*/
public class UnsupportedActionCodeOperationException extends Exception {
protected int operation;
public UnsupportedActionCodeOperationException(int operation) {
super("The ActionCodeResult.Operation value of " + operation + " is not supported");
this.operation = operation;
}
public int getOperation() {
return this.operation;
}
}

Related

how to redirect user to play store when we click on app link shared to whatsapp when particular app is not in his device

This is the link which i created to share an url of a particular product in java class
String url="http://www.example.com/productId/";
String finalurl = url + productId.getText().toString();
Intent i = new Intent(Intent.ACTION_SEND);
i.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
i.setType("*/*");
i.putExtra(Intent.EXTRA_STREAM, getLocalBitmapUri(bitmap));
i.putExtra(Intent.EXTRA_TEXT, name.getText().toString()+ "\n" + finalurl);
startActivity(Intent.createChooser(i, "Share Image"));
this is the intent filter that has created to an activity through App links Assistant
<activity
android:name=".login.Launchscreen"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="www.example.com"
android:pathPrefix="/productId"
android:scheme="http" />
</intent-filter>
<tools:validation testUrl="http://www.example.com/productId/" />
</activity>
this is the java code through which i can extract the data which i appended to my link
Intent intent = getIntent();
String appLinkAction = intent.getAction();
Uri appLinkData = intent.getData();
if (Intent.ACTION_VIEW.equals(appLinkAction) && appLinkData != null) {
proid = appLinkData.getLastPathSegment();
}
through above code i can share url through whatsapp and when i click on the shared app link it is redirecting to my app successfully but what i need is i want to redirect the user to play store when my application is not in his device and when the application is in his device he should be navigated to particular activity. can anyone help me please.All i want is in android app.Thanks in advance
You can check whether app is installed or not using package manager
final boolean isAppInstalled = appInstalledOrNot(\\ your URL package name\\);
private boolean appInstalledOrNot(String packagname) {
PackageManager pm = getActivity().getPackageManager();
try {
pm.getPackageInfo(packagname, PackageManager.GET_ACTIVITIES);
return true;
} catch (PackageManager.NameNotFoundException e) {
return false;
}
}
// now check on your button click
if (isAppInstalled)
{
Intent LaunchIntent = getContext().getPackageManager().getLaunchIntentForPackage(\\ your URL package name\\);
getContext().startActivity(LaunchIntent);
} else {
try {
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(\\your URL\\));
} catch (android.content.ActivityNotFoundException anfe) {
anfe.printStackTrace();
}
}
you can use branch.io for create deep link and check app is not install go
to play store.
https://branch.io/how-branch-links-work/
step 1: Above link sign up
step 2: open branch dashboard
step 3. select Set Up SDK then open new page that page select your device
step 4: if you select android open new page that page contain this option
follow this
1.Enter app information
2.Get the SDK files
3.Configure Manifest
4.Start a Branch session
step 5: come back to dashboard see first option LIVE and TEST
1.you click live then select Account Setting see live key
2.you click test then select Account Setting see test key
<meta-data
android:name="io.branch.sdk.BranchKey"
android:value="put live key" />
<meta-data
android:name="io.branch.sdk.BranchKey.test"
android:value="put test key" />
if use test key for testing perpose, if you go to live set false
<meta-data
android:name="io.branch.sdk.TestMode"
android:value="true" />
step 6: go to link setting
1.see android
1.select two check box one I have an Android App and Enable app link
2.see Android URI Scheme enter your uri for if you install the app
you click the deep link open the app.
(example:appName://open)
3.see google play search for if you not install the app then redirect to
google play store
1.first you upload app to play store then search and set
4.set SHA256 Cert Fingerprints
5.see link domain option
1.use Default Link Domain link
<activity
android:name=".MainActivity"
android:alwaysRetainTaskState="true"
android:configChanges="orientation"
android:hardwareAccelerated="true"
android:launchMode="singleTask"
android:screenOrientation="portrait"
android:theme="#style/MyAppTheme">
<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:host="open"
android:scheme="set your android Scheme uri" />
<data
android:host="Default Link Domain link"
android:pathPrefix="/"
android:scheme="https" />
</intent-filter>
</activity>
step 7: click deep link handle on MainAtivity
public void onStart() {
super.onStart();
Branch branch = Branch.getInstance();
// Branch init
branch.initSession(new Branch.BranchReferralInitListener() {
#Override
public void onInitFinished(JSONObject referringParams, BranchError error) {
if (error == null) {
if(referringParams.has("post_id")){
mPostId = referringParams.getString("post_id");
}
} else {
Log.i("BRANCH SDK", error.getMessage());
}
}
}, this.getIntent().getData(), this);
}
step 8: create deep link for post or news in your app
try {
BranchUniversalObject buo = new BranchUniversalObject()
.setCanonicalIdentifier("app/launch")
.setTitle("appName")
.setContentDescription(postContent)
.setContentImageUrl(imageUrl)
.setContentIndexingMode(BranchUniversalObject.CONTENT_INDEX_MODE.PUBLIC)
.setContentMetadata(new ContentMetadata()
.addCustomMetadata("install", "true")
.addCustomMetadata("TYPE", "POST")
.addCustomMetadata("post_id", "" + postId));
LinkProperties lp = new LinkProperties().setChannel("url_share")
.setFeature("sharing")
.setCampaign("post share")
.setStage("cricspace")
.addControlParameter("$desktop_url", "your app web link")
.addControlParameter("mobile", mobileNo)
.addControlParameter("post_id", "" + postId)
.addControlParameter("TYPE", "POST")
.addControlParameter("custom_random",
Long.toString(Calendar.getInstance().getTimeInMillis()));
ShareSheetStyle shareSheetStyle = new ShareSheetStyle(context, "Check this
out!", postContent)
.setCopyUrlStyle(context.getResources().
getDrawable(android.R.drawable.ic_menu_send), "Copy", "Added to
clipboard")
.setMoreOptionStyle(context.getResources().
getDrawable(android.R.drawable.ic_menu_search), "Show more")
.addPreferredSharingOption(SharingHelper.SHARE_WITH.FACEBOOK)
.addPreferredSharingOption(SharingHelper.SHARE_WITH.WHATS_APP)
.addPreferredSharingOption(SharingHelper.SHARE_WITH.GMAIL)
.addPreferredSharingOption
(SharingHelper.SHARE_WITH.FACEBOOK_MESSENGER)
.addPreferredSharingOption(SharingHelper.SHARE_WITH.HANGOUT)
.addPreferredSharingOption(SharingHelper.SHARE_WITH.INSTAGRAM)
.addPreferredSharingOption(SharingHelper.SHARE_WITH.WECHAT)
.addPreferredSharingOption(SharingHelper.SHARE_WITH.TWITTER)
.setAsFullWidthStyle(true)
.setSharingTitle("Share With");
// buo.setContentDescription(postModel.getPostContent()+"\n\n"
+deepLinkReferralURL );
buo.generateShortUrl(context, lp, (url, error) -> {
if (error == null) {
buo.showShareSheet((AppCompatActivity) context, lp,
shareSheetStyle, new Branch.BranchLinkShareListener() {
#Override
public void onShareLinkDialogLaunched() {
onCallBack.onShareLinkDialog();
}
#Override
public void onShareLinkDialogDismissed() {
}
#Override
public void onLinkShareResponse(String sharedLink, String
sharedChannel, BranchError error) {
}
#Override
public void onChannelSelected(String channelName) {
}
});
}
});
} catch (Exception e) {
Log.e("error", e.toString());
}

Firebase Dynamic Link PendingDynamicLinkData return null android

I tried the below firebase official dynamic link sample but is not working for me.
Dynamic Link:
Mainfest:
<activity android:name=".java.MainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<!-- [START link_intent_filter] -->
<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:host="plpsoft.page.link"
android:scheme="https"/>
<data
android:host="plpsoft.page.link"
android:scheme="http"/>
</intent-filter>
<!-- [END link_intent_filter] -->
</activity>
Activity:
#Override
protected void onCreate(Bundle savedInstanceState) {
FirebaseDynamicLinks.getInstance()
.getDynamicLink(getIntent())
.addOnCompleteListener(new OnCompleteListener<PendingDynamicLinkData>() {
#Override
public void onComplete(#NonNull Task<PendingDynamicLinkData> task) {
Uri deepLink = null;
if (task.getResult() != null) {
deepLink=task.getResult().getLink();
((TextView) findViewById(R.id.linkViewReceive))
.setText(deepLink.toString());
}
}
})
.addOnSuccessListener(this, new OnSuccessListener<PendingDynamicLinkData>() {
#Override
public void onSuccess(PendingDynamicLinkData pendingDynamicLinkData) {
// Get deep link from result (may be null if no link is found)
Uri deepLink = null;
if (pendingDynamicLinkData != null) {
deepLink = pendingDynamicLinkData.getLink();
}
// Handle the deep link. For example, open the linked
// content, or apply promotional credit to the user's
// account.
// ...
// [START_EXCLUDE]
// Display deep link in the UI
if (deepLink != null) {
Snackbar.make(findViewById(android.R.id.content),
"Found deep link!", Snackbar.LENGTH_LONG).show();
((TextView) findViewById(R.id.linkViewReceive))
.setText(deepLink.toString());
} else {
Log.d(TAG, "getDynamicLink: no link found");
}
// [END_EXCLUDE]
}
})
.addOnFailureListener(this, new OnFailureListener() {
#Override
public void onFailure(#NonNull Exception e) {
Log.e("Splash", "getDynamicLink:onFailure", e);
}
})
.addOnFailureListener(this, new OnFailureListener() {
#Override
public void onFailure(#NonNull Exception e) {
Log.w(TAG, "getDynamicLink:onFailure", e);
}
});
}
While tapping the URL the app will launch successfully and i get the intent data URI string also. if i pass this URI to getDynamicLink() method it's return as null. I also add the both SHA1 and SHA256 key in firebase console.
I was able to fix it by removing the intent-filter from the manifest and adding the callback handler in the MainActivity.
What the docs says is that:
In the callback the PendingDynamicLinkData is returned in addOnSuccessListener(OnSuccessListener) or addOnCompleteListener(Activity, OnCompleteListener) which returns the most recently clicked dynamic link, or null if a dynamic link was not pending as captured data or in the intent.
So the deeplink was being captured by the intent filter and because it was not longer pending the callback returns null

Android redirect uri

I'm working with the instagram API and I don't understand what I should put in for the redirect api. At the moment I simply put in https://127.0.0.1
But I dont really understand. Also, once I get the allow/cancel screen and I press allow it gives me an error saying that I cant go to that address but I can also see the authorization code appended on to the address. So how can i redirect back from my redirect uri? How can I tell android that after user clicks allow to come back into the app use the code for further authentication?
Im sure you will say something like make my own custom scheme/ intent filters etc but please be a little more supportive im new and I dont understand and I did do research on them.
My on resume method is below
#Override
protected void onResume() {
super.onResume();
// the intent filter defined in AndroidManifest will handle the return from ACTION_VIEW intent
Uri uri = getIntent().getData();
if (uri != null && uri.toString().startsWith(redirectUri)) {
// use the parameter your API exposes for the code (mostly it's "code")
String code = uri.getQueryParameter("code");
if (code != null) {
// get access token
LoginService loginService =
ServiceGenerator.createService(LoginService.class, clientId, clientSecret);
AccessToken accessToken = loginService.getAccessToken(code, "authorization_code");
} else if (uri.getQueryParameter("error") != null) {
// show an error message here
}
}
}
This is my manifest snippet dealing with intent filters:
<activity
android:name=".LoginActivity"
android:label="#string/title_activity_login" >
<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:host="redirecturi"
android:scheme="your" />
</intent-filter>
</activity>
You have to setup an event listener on the browser view and check for code in URL param if the URL is equal to the redirect_uri, and then make POST request to the auth URL using the code and client_secret as documented in Instagram authentication
something like this:
webView.setWebViewClient(new WebViewClient() {
public void onPageFinished(WebView view, String url) {
String code = url.getQueryParameter("code");
// ...
}
});

Android Wear message sent from watch is not received by the phone devie

I want to send message from Watch to my phone.
I can send a message using MessageAPI to my phone, and the result is successful too by looking at the log message. However, the message is not received on the phone's side.
Wearable.MessageApi.sendMessage(mGoogleApiClient, mNode.getId(),
MY_DATA_PATH, null).setResultCallback(
new ResultCallback<MessageApi.SendMessageResult>() {
#Override
public void onResult(
MessageApi.SendMessageResult sendMessageResult) {
if (!sendMessageResult.getStatus().isSuccess()) {
Log.d("TAG",
"sendMessageResult NOT successful");
} else {
Log.d("TAG",
"sendMessageResult successful");
}
}
});
However, on my phone's listener service, onMessageReceived and onPeerConnected are not called.
public class ListenerServiceFromWear extends WearableListenerService {
private static final String My_DATA_PATH = "/my-data-path";
#Override
public void onMessageReceived(MessageEvent messageEvent) {
Log.d("TAG", "onMessageReceived");
/*
* Receive the message from wear
*/
if (messageEvent.getPath().equals(MY_DATA_PATH)) {
Intent startIntent = new Intent(this, ContactActivity.class);
startIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(startIntent);
}
}
#Override
public void onPeerConnected(Node node){
Log.d("TAG", "onPeerConnected");
}
}
Here is the phone app's Manifest declaration for the ListenerService:
<service android:name="com.mobile.rbc.services.ListenerServiceFromWear" >
<intent-filter>
<action android:name="com.google.android.gms.wearable.BIND_LISTENER" />
</intent-filter>
</service>
Found the answer.
The problem is that the Android Wear's apk is signed and the Phone's apk is not signed.
I was debugging it using Eclipse, that's why the phone's app is not signed.
Usually you will see something in your log if the two apks are not signed with the same key.
ensureBindStarted: app does not match record's app key: AppKey

How to check callback_url in twitter application

i have loads of examples for O_Auth but no one is working properly and i guess the only thing is callback URL in every example, I am getting 401 error like consumer key or signature didn't match. I already seen so many examples on 401 the only thing that goes into my favor is my callback url.
android app cannot connect to twitter.
Getting 401 when requesting access token with signpost within android with-signpost-within-android
Android Dev - Callback URL not working... (0_o)
I already seen all these examples and many more.
But still i am not getting my point, If at the time of application form i use http://www.meomyo.com at callback url, Then what should i use it in my coding
like android:scheme="?" android:host="?"
currrently i am using other examples callbacks
//private static final Uri CALLBACK_URI = Uri.parse("bloa-app://twitt");
private static final Uri CALLBACK_URI = Uri.parse("twitterapp://connect");
i have consumer key as well secret key, but in case of callback url i am stuck on it.
If anyone want i can provide my consumer as well secret key.
public class OAuth extends Activity {
private static final String APP = "OAUTH";
private Twitter twitter;
private OAuthProvider provider;
private CommonsHttpOAuthConsumer consumer;
private String CONSUMER_KEY = "Xh3o8Gh1JQnklkUnTvvA";
private String CONSUMER_SECRET = "SCLy6yoUSth53goAsYYkoqR4ZuBoaInyJXsm5PQR11I";
private String CALLBACK_URL = "merabharatmahan://piyush";
private TextView tweetTextView;
private Button buttonLogin;
#Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
tweetTextView = (TextView)findViewById(R.id.tweet);
buttonLogin = (Button)findViewById(R.id.ButtonLogin);
buttonLogin.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
askOAuth();
}
});
}
/**
* Open the browser and asks the user to authorize the app.
* Afterwards, we redirect the user back here!
*/
private void askOAuth() {
try {
consumer = new CommonsHttpOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET);
provider = new DefaultOAuthProvider("http://twitter.com/oauth/request_token",
"http://twitter.com/oauth/access_token",
"http://twitter.com/oauth/authorize");
String authUrl = provider.retrieveRequestToken(consumer, CALLBACK_URL);
Toast.makeText(this, "Please authorize this app!", Toast.LENGTH_LONG).show();
this.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(authUrl)));
} catch (Exception e) {
Log.e(APP, e.getMessage());
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
}
}
/**
* As soon as the user successfully authorized the app, we are notified
* here. Now we need to get the verifier from the callback URL, retrieve
* token and token_secret and feed them to twitter4j (as well as
* consumer key and secret).
*/
#Override
protected void onNewIntent(Intent intent) {
super.onNewIntent(intent);
Uri uri = intent.getData();
if (uri != null && uri.toString().startsWith(CALLBACK_URL)) {
String verifier = uri.getQueryParameter(oauth.signpost.OAuth.OAUTH_VERIFIER);
try {
// this will populate token and token_secret in consumer
provider.retrieveAccessToken(consumer, verifier);
// TODO: you might want to store token and token_secret in you app settings!!!!!!!!
AccessToken a = new AccessToken(consumer.getToken(), consumer.getTokenSecret());
// initialize Twitter4J
twitter = new TwitterFactory().getInstance();
twitter.setOAuthConsumer(CONSUMER_KEY, CONSUMER_SECRET);
twitter.setOAuthAccessToken(a);
// create a tweet
Date d = new Date(System.currentTimeMillis());
String tweet = "#OAuth working! " + d.toLocaleString();
// send the tweet
twitter.updateStatus(tweet);
// feedback for the user...
tweetTextView.setText(tweet);
Toast.makeText(this, tweet, Toast.LENGTH_LONG).show();
buttonLogin.setVisibility(Button.GONE);
} catch (Exception e) {
Log.e(APP, e.getMessage());
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
}
}
}
}
manifest code is
<application android:icon="#drawable/icon" android:label="#string/app_name">
<activity android:name=".OAuth"
android:label="#string/app_name"
android:launchMode="singleInstance">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<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="merabharatmahan" android:host="piyush" />
</intent-filter>
</activity>
</application
now i am getting communication with the service provider is failed: Received Authentication challenge is null. It is the simplest example that i put here.
twitterapp://connect is your call back url.
In Android manifest.xml define your activity like this:
<activity android:name=".auth.SocialNetworkActivity"
android:configChanges="orientation"
android:label="Connect SNS" android:launchMode="singleTask">
<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="twitterapp" android:host="connect" />
</intent-filter>
</activity>
Now, it will open twitter web page, and on successful authentication, your activities onNewIntent() callback method will be called.
In above example, use your own activity name.
Apart from that, twitter integration in my application is done using twitter4j.
You must put whatever you think will be unique:
android:scheme="name-of-your-dog" android:host="something-else"
Oh, wait... maybe there's someone else owning a dog called like yours... so, use the package name of your app:
android:scheme="com.your.package" android:host="something-else"
And, if it's not working for you... I don't think it's related to the callback URL. How are you declaring your activity in the manifest? You added the android:launchMode="singleTask" parameter, right?
And, as the zombie guy pointed out, you must handle the callback in the onNewIntent method of your auth activity. Something like this:
final Uri uri = intent.getData();
if (uri != null && uri.getScheme().equals("name-of-your-dog")) {
//etc...
}

Categories

Resources