[android-developers] Re: how to capture browser activity or callback
Sorry for the late response. You can actually just set the activity with a scheme "myapp://" and that schmee is uses as a url to call your activity "myapp:///?token=1234" And then you can use onResume to parse out the token; URI result = getIntent.getData(); The scheme must be set in the mabifest file for that app On Sep 15, 10:52 am, Carmen Delessio wrote: > I think I understand the scenario, I have an answer that works when > accessing a web URL that returns a token via a WebView. > > You have an initial URL like:http://www.givemeatoken.com > that returnshttp://www.givemeatoken.com?yourToken=12345 > > I handle this by: > 1. creating a WebView > 2. loading the urlhttp://www.givemeatoken.cominto the WebView > 3. Setting the webView client to my own webview.setWebViewClient(new > MyWebViewClient()); > 4. Overriding the onPageStarted method in MyWebViewClient > > So MyWebViewClient looks like: > > private class MyWebViewClient extends WebViewClient { > �...@override > public void onPageStarted (WebView view, String url, Bitmap > favicon){ > if (url.startsWith("http://www.givemeatoken.com?yourToken=";){ > // parse the URL to get the token > } > > This gives me a chance to "filter" the incoming URL. I am not sure if there > are other ways to do this. > > Carmen > -- > Carmenhttp://www.twitter.com/CarmenDelessiohttp://www.talkingandroid.com > > On Tue, Sep 15, 2009 at 10:35 AM, Smelly Eddie wrote: > > > I hate to bump, but this got covered yesterday by 20+ posts fromm the > > same user at 4:18. > > > Anyone have experiencing using schemes and callback uris? > > > Regards, > > > Eddie > > > On Sep 14, 3:52 pm, Smelly Eddie wrote: > > > My activity calls a browser activity where the users submits their > > > info to retrieve a PIN. That PIN is then sent as a parameter to a url > > > specified in the request. > > > > I tried adding aschemeto my activity > > > -- > > > > > android:host="com.edwardawebb.myapp.class" /> > > > -- > > > And setting thecallbackurl to myscheme://?reponseParameter=868668687 > > > > I want the method below to recieve thecallback, but it gets nothing > > > > -- > > > public class PinReceiver extends BroadcastReceiver{ > > > // retrive PIN after user links withwebsite thorugh browser > > > @Override > > > public void onReceive(Context context, Intent intent){ > > > // Send a text notification to the screen. > > > NotificationManager nm = (NotificationManager) > > > context.getSystemService(Context.NOTIFICATION_SERVICE); > > > > } > > > } > > > -- > > > > What Happens; > > > > -The browser launches (first page loads successfully) > > > -User enters info > > > -But the browser just says > > > "the webpage myscheme://?reponseParameter=868668687 is not available" > > > > How do I get the browser to recognize myscheme:// as an internalscheme? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: how to capture browser activity or callback
I think I understand the scenario, I have an answer that works when accessing a web URL that returns a token via a WebView. You have an initial URL like: http://www.givemeatoken.com that returns http://www.givemeatoken.com?yourToken=12345 I handle this by: 1. creating a WebView 2. loading the url http://www.givemeatoken.com into the WebView 3. Setting the webView client to my own webview.setWebViewClient(new MyWebViewClient()); 4. Overriding the onPageStarted method in MyWebViewClient So MyWebViewClient looks like: private class MyWebViewClient extends WebViewClient { @Override public void onPageStarted (WebView view, String url, Bitmap favicon){ if (url.startsWith(" http://www.givemeatoken.com?yourToken=";){ // parse the URL to get the token } This gives me a chance to "filter" the incoming URL. I am not sure if there are other ways to do this. Carmen -- Carmen http://www.twitter.com/CarmenDelessio http://www.talkingandroid.com On Tue, Sep 15, 2009 at 10:35 AM, Smelly Eddie wrote: > > I hate to bump, but this got covered yesterday by 20+ posts fromm the > same user at 4:18. > > Anyone have experiencing using schemes and callback uris? > > Regards, > > Eddie > > On Sep 14, 3:52 pm, Smelly Eddie wrote: > > My activity calls a browser activity where the users submits their > > info to retrieve a PIN. That PIN is then sent as a parameter to a url > > specified in the request. > > > > I tried adding aschemeto my activity > > -- > > > android:host="com.edwardawebb.myapp.class" /> > > -- > > And setting thecallbackurl to myscheme://?reponseParameter=868668687 > > > > I want the method below to recieve thecallback, but it gets nothing > > > > -- > > public class PinReceiver extends BroadcastReceiver{ > > // retrive PIN after user links withwebsite thorugh browser > > @Override > > public void onReceive(Context context, Intent intent){ > > // Send a text notification to the screen. > > NotificationManager nm = (NotificationManager) > > context.getSystemService(Context.NOTIFICATION_SERVICE); > > > >} > > } > > -- > > > > What Happens; > > > > -The browser launches (first page loads successfully) > > -User enters info > > -But the browser just says > > "the webpage myscheme://?reponseParameter=868668687 is not available" > > > > How do I get the browser to recognize myscheme:// as an internalscheme? > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---
[android-developers] Re: how to capture browser activity or callback
I hate to bump, but this got covered yesterday by 20+ posts fromm the same user at 4:18. Anyone have experiencing using schemes and callback uris? Regards, Eddie On Sep 14, 3:52 pm, Smelly Eddie wrote: > My activity calls a browser activity where the users submits their > info to retrieve a PIN. That PIN is then sent as a parameter to a url > specified in the request. > > I tried adding aschemeto my activity > -- > android:host="com.edwardawebb.myapp.class" /> > -- > And setting thecallbackurl to myscheme://?reponseParameter=868668687 > > I want the method below to recieve thecallback, but it gets nothing > > -- > public class PinReceiver extends BroadcastReceiver{ > // retrive PIN after user links withwebsite thorugh browser > @Override > public void onReceive(Context context, Intent intent){ > // Send a text notification to the screen. > NotificationManager nm = (NotificationManager) > context.getSystemService(Context.NOTIFICATION_SERVICE); > > } > } > -- > > What Happens; > > -The browser launches (first page loads successfully) > -User enters info > -But the browser just says > "the webpage myscheme://?reponseParameter=868668687 is not available" > > How do I get the browser to recognize myscheme:// as an internalscheme? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~--~~~~--~~--~--~---