Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8308997
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T18:58:27+00:00 2026-06-08T18:58:27+00:00

Hi i created an android project in which i make a main activity @Override

  • 0

Hi i created an android project in which i make a main activity

@Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        String ss="https://accounts.google.com/o/oauth2/auth?client_id=anonymous&redirect_uri=https://cloudspokeproject.appspot.com/oauth2callback&response_type=code&scope=https://www.googleapis.com/auth/apps.groups.settings  https://apps-apis.google.com/a/feeds/groups/";

            Uri url=Uri.parse(ss);
            Intent in=new Intent(Intent.ACTION_VIEW,url);
            startActivity(in);


    }

and then created a Response Activity
with code

public class Response extends Activity {

@Override
    public void onCreate(Bundle bundle){
        super.onCreate(bundle);
        TextView text=new TextView(this);
    Uri uri=this.getIntent().getData();
    String code=uri.getQueryParameter("code");
    URL url;
    try {
        url = new URL("https://accounts.google.com/o/oauth2/token");

         String param="code="+code+"&client_id=anonymous&client_secret=anonymous&redirect_uri=https://cloudspokeproject.appspot.com/oauth2callback&grant_type=authorization_code";

         HttpURLConnection connection = 
    (HttpURLConnection)url.openConnection(); 
         connection.setDoOutput(true); 
         connection.setRequestMethod("POST"); 
         connection.setRequestProperty("Content-type", "application/x-www-form-urlencoded");
         connection.getOutputStream().write( param.getBytes() ); 
      InputStream str= connection.getInputStream();
      BufferedReader reader=new BufferedReader(new InputStreamReader(str));
    String l="";
    String l1="";
    while((l=reader.readLine())!=null){
        l1+=l;
    }
        text.setText(l1);
        setContentView(text);

    } catch (MalformedURLException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }


    }}

and here is my menifest file code

<uses-sdk
    android:minSdkVersion="7"
    android:targetSdkVersion="15" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

    </activity>
 <activity
     android:name=".Response"
     android:label="Hello World"
     android:exported="false">
     <intent-filter>
          <action android:name="android.intent.action.VIEW"/> 
          <category android:name="android.intent.category.BROWSABLE"/> 
          <category android:name="android.intent.category.DEFAULT"/> 
          <data android:host="cloudspokeproject.appspot.com/oauth2callback" android:scheme="https"/> 
          </intent-filter>
 </activity>


</application>

i am trying to implement google Authentication for an app and Main Activity is opening a google login and after signing in it is redirected to clouspokeproject.appspot.com/oauth2callback but as i put an intent filter in Response activity in menifest .when url cloudspokeproject.apspot.com/oauth2callback is called in browser then android should redirect it to activity Response.i successfully implemented oauth for twitter and couple of other apis but this time its not redirecting to Response activity
can any one please tell where i am wrong.i know mistake is very minor please point me so that i can rectify it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T18:58:29+00:00Added an answer on June 8, 2026 at 6:58 pm

    Hi for returning back to my my activity intent filter should be like

    <intent-filter>
              <action android:name="android.intent.action.VIEW"/> 
              <category android:name="android.intent.category.BROWSABLE"/> 
              <category android:name="android.intent.category.DEFAULT"/> 
              <data android:host="cloudspokeproject.appspot.com" android:scheme="https"/> 
              </intent-filter>
    

    i have to remove /oauth2callback in host attribute because its a very rare url and used for only once in project so its working fine for me now.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to build my android project with ndk so i created my make
I created an Android library project and an app project which is use my
I've created a new Android project in which the only code I've added is
I created an Android project a few months ago and now have to automate
I created an Android project in AIDE on my android phone running ICS and
I created a project, probably as an Android project without thinking. I then did
I am trying to create an android project using eclipse IDE,its created successfully but
I have created a MazeSolver android app for a school project. I am using
i have one doubt,i have created new project in eclipse with android 2.3.1 and
I'm trying to create an Android test project from within my main project. Exactly

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.