Redirect without invoke onPageStarted - android

It a sample question, can i redirect to another URL without make onPageStarted invoked?, without edit my java code
it will help me to test my app's security, i hope any one have idea if it possible :).
Thanks

You can try using <iframe> because onPageStarted will not be called when the contents of an embedded frame changes. If this is not a choice for you, I'm afraid there is no way to stop calling onPageStarted.
Another possible way (maybe this is my imagination) is to modify Android source code. To achieve this, you can follow the steps mentioned there. Basically, you need to download Android source, build it, and modify some code (maybe delete onPageStarted). This can be complicated and I'm not sure whether this can work.

Related

change browser home page in android [duplicate]

Within my app, is it possible to programatically change the Android browser's homepage url? If so, how can I accomplish this?
For example, if you run this popular app with Android 2.3 (all that I've tested), it will change your homepage to http://www.searchmobileonline.com
-- https://market.android.com/details?id=goldenshorestechnologies.brightestflashlight.free
Thanks!
I did not try this myself, but BrowserSettings has a public interface setHomePage:
public void setHomePage(Context context, String url) {
Editor ed = PreferenceManager.
getDefaultSharedPreferences(context).edit();
ed.putString(PREF_HOMEPAGE, url);
ed.commit();
homeUrl = url;
}
It is used in BrowserBookmarksPage like this:
BrowserSettings.getInstance().setHomePage(this, [URL]);
But that BrowserSettings class is only accessible from that package. So maybe accessing the shared preferences is easier... ?
MORE...
Not really here to be giving a lesson. It may be possible to do, maybe with some native code accessing the XML file with the preferences for the Browser or other ways like this, but...
No matter what you do, this would be going "around" the security in
place. Your app should not be able to change the homepage of the
Browser (or it would be in the documentation)
Even if it is possible to find a way to do it (through NDK or finding undocumented interfaces), it would most likely stop working at some point with some new release of Android, which is probably not what you would want.
I understand some app already do it, and IMHO, that's bad. Does not mean that your app should be doing the same and frustrate more potential users.
There is NO WAY to change the homepage url of the browser.
com.android.browser opens/creates a preference with MODE_PRIVATE. So the files's attributes are became as -rw-rw----
And also browser app's menifest has no sharedUserId attribute.
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.browser">
The app doesn't provide the chance to share app's preference file.
This cannot be accomplished programmatically from within your app.
Edit: I downloaded the application you provided, and it does appear to accomplish what you're looking for. How exactly it was done, I have no clue. I can't find anything online on how to do this. I'm interested to see if anyone has any ideas on how they accomplished this.
I hava a opinion:
Maybe you can read the source code of Browser and find the code like this:
SharedPreferences prefs = mContext.getSharedPreferences(RECOVERY_PREFERENCES, Context.MODE_PRIVATE);
and get the SharedPreferences of Browser,then find the place to set homepage, change it.
Is that possible?
Im guessing the app developer didnt write it in his code to do that. I think one of the 11 ad sdks he has in his app is causing it.
He has
adserver.adview
adwhirl
amobee.onlinehapi
apperhand
google
inmobi.androidsdk
jumptap.adtag
mdotm.android.ads
millenialmedia.android
mobclix.android.sdk
zestadz.android
as a side note this is ridiculous.
I authored the app called My Home Page (https://play.google.com/store/apps/details?id=com.aac.myhomepage) where I needed to accomplish this exact task. I looked everywhere possible and couldn't find a method of doing this so I ended up using two workarounds which really aren't great options in my opinion.
1) I offer a root option for those who have rooted devices where I simply access the SharedPreferences XML file of the browser and, using regular expressions, swap out the value of the home page with the one needed.
2) Copy the URL to the clipboard and tell the user how to accomplish changing the default home page.
Note that I did not use root access without the user's permission nor did I change the home page without the user's permission. This is the purpose of the app and the home page isn't changed without the user explicitly doing so.
I recently noticed that the ad SDKs were doing this but something tells me that they aren't doing it in a proper manner and I don't have any interest i

slideshare in android app

I am new to Android and I am studying the possibility of including/embedding a slideshare slideshow (among other contents) into an Android app.
The idea would be receiving from the user the URL of the resource, such as:
"http://es.slideshare.net/slideshow/embed_code/16060200?rel=0"
And in certain section of the app display the slideshow mixed with other contents (text or whatever...)
I have been searching and the only option I saw (I insist I am really new to this...) would be making a webview for that activity... but... Is a webview fullscreen only? Can it be just part of an activty?
I hope I got to make myself understood... otherwise, let's try to clear it out and ask me whatever you may need to understand the question ;)
Thank you very much in advance,
Miguel
PS: I can accept other systems instead of slideshare, what i want is to embed an slideshow
Sounds like what you need is a WebView, just like you said. They can be non-fullscreen as well. Not sure how much this helps, but here's a tutorial on WebView's from the dev site:
Building Web Apps in WebView

Android Developer:: Opening external link within the app

Happy Friday to all.
I was wondering if there is a way to open an external link within the app itself? I currently can execute a link, but it opens it in a browser. I would like to open a site or two within the app.
Can this be done?
Oh, please tell me it can be, because this is one of the reasons why I am creating my app in Eclipse instead of Dreamweaver...html can only limit so much stuff!
please and thank you help me figure this out.
Cady
Yes, you need to use a WebView and load the html into it yourself.
Note that by default a WebView only displays html content. The plugins and javascript are off, and it does not handle link clicks, or forward / backward navigation
http://developer.android.com/reference/android/webkit/WebView.html
You can use a WebView to open HTML pages inside your app. There's a nice little tutorial in the docs showing the use of its basic features.
You can use WebView, put it in your layout and load URLs to show websites inside your app.
Yes it can be done, you can use a WebView to load the content inside your activity.

Is it possible to lock the orientation on android through JavaScript?

Is that even possible? I doubt it, but want to make sure.
If you're not allowed to write any Java code to perform this "orientation lock", then, no, it's not possible to lock the orientation of the app from JavaScript.
You could simulate 'locking' if you detected the orientation change as mentioned in the Detect rotation of Android phone in the browser with javascript link and readjusted your HTML accordingly. But that seems like a lot of work.
If you can use Java, then you can expose a Java object through the WebView.addJavascriptInterface method and write some JavaScript to get/set the orientation using the Activity.setRequestedOrientation and Activity.getRequestedOrientation methods.
Why not? There's some simple trick coming to my mind... from Javascript you call the document.open() method with some custom url. On shouldOverrideUrlLoading view,url) you catch that call with your custom url, and so you do whatever you want.
Maybe I'm missing something... but I would try.
And well, I assume you already know that, but you have to use a WebView to embed some sort of web browser within your application.
==== EDIT ====
Well it seems I was missing something, and there is a much more classy way to do it. There is this tutorial (section Binding JavaScript code to Android code) which shows you how to add a JavaScriptAndroid interface, something related with what you want, if I'm not wrong. I haven't tried it, but it doesn't seem too difficult.
At my work place, we had a similar issue with orientation changes in the device browser. We simply popped a modal window when the orientation changed. It informed the user to rotate the device back to continue. Seemed to work well on all our tested devices.

Android webview and google acount?

Hey everyone,
I'm working an app that includes a webbrowser inside.
I've done quite some progress with getting the webview widget to work as necessary, but this thing really puzzles me.
I can't get the webview to forget my google account, even with deleting cache and history, it still remembers it. Which is really annoying since the application will be used by many users on a single device.
Any help very much appreciated
You need to clear cookies too. Use CookieManager to remove all cookies. For example, you can add this to your onDestroy():
CookieManager.getInstance().removeAllCookie();
On top of clearing the cache and history locally, you could just loadUrl for:
https://www.google.com/accounts/Logout
This should make sure the session is ended on Google's end.
Seems like a logical solution to me.

Categories

Resources