PDA

View Full Version : مشکل در وب ویو پس از چرخاندن دستگاه



ze_ca_742
پنج شنبه 09 بهمن 1393, 13:58 عصر
سلام

مشکلم اینه که وقتی در نزم افزارم وب ویو رو تنظیم میکنم که از asset یک فایلی رو نشون بده (مثلا main.html) و از همین صفحه main که توی asset قرار دادم به فایل های html دیگه منتقل میشم (مثلا list.html) , وقتی دستگاه رو میچرخونم کلا بر میگرده به همون فایل اولی که باز کرده بودم یعنی همون main.html

میخواستم ببینم کدی وجود داره که نزاره وب ویو ریست بشه یعنی توی هر صفحه ای که وارد شدم بمونه (مثلا همون list.html) البته بعد از چرخوندن

با تشکر

jalil_gh
جمعه 10 بهمن 1393, 20:59 عصر
این کدها رو اضافه کنید احتمالاً درست می‌شه.
@Overrideprotected void onSaveInstanceState(Bundle outState){
super.onSaveInstanceState(outState);
this.webView.saveState(outState);
}

@Override
protected void onRestoreInstanceState(Bundle inState){
super.onRestoreInstanceState(inState);
this.webView.restoreState(inState);
}

فقط به جای webView تو کد، وب ویو خودتونو بزارید.

smemamian
جمعه 10 بهمن 1393, 21:37 عصر
سلام و درود

اگر برنامه شما آینده دار هست و یا برای سازمان/شرکت در حال برنامه نویسی هستید باید در نظر داشته باشید که عملاً WebView دیگر توسعه داده نخواهد شد( به دلایل امنیتی).
و این یعنی ممکن است چند سال آینده با مشکل رو برو شوید.
(متاسفانه کافه بازار هم از WenView استفاده می کند... ! )

مرگ نرم افزار، تغییرات است.

#root#
جمعه 10 بهمن 1393, 21:48 عصر
سلام و درود

اگر برنامه شما آینده دار هست و یا برای سازمان/شرکت در حال برنامه نویسی هستید باید در نظر داشته باشید که عملاً WebView دیگر توسعه داده نخواهد شد( به دلایل امنیتی).
و این یعنی ممکن است چند سال آینده با مشکل رو برو شوید.
(متاسفانه کافه بازار هم از WenView استفاده می کند... ! )

مرگ نرم افزار، تغییرات است.

سلام
من یه خبری دیدم چند وقت پیش که انگاری قراره مثل Google Play Service (البته دقیق نمیدونم که اینم از سیستم عامل جدا شده یا کلا از اول جدا بوده) جدا بشه از سیستم عامل و بروزرسانی هاش مثل این برنامه باشه، منظورتون همینه یا یه چیز دیگه؟

این جمله سبز رنگ رو میشه کمی باز کنید : )

jalil_gh
جمعه 10 بهمن 1393, 22:26 عصر
WebView دیگر توسعه داده نخواهد شد

می‌تونید یه لینکی چیزی برای تایید صحت این گفته‌تون بدید؟

smemamian
جمعه 10 بهمن 1393, 22:57 عصر
Adrian Ludwig مهندس ارشد بخش امنیتی گوگل هستش که در صفحه شخصی خودش این نکته رو اعلام کرد :







Following public discussion of vulnerabilities in versions of Webkit last week, I’ve had a number of people ask questions about security of browsers and WebView on Android 4.3 (Jellybean) and earlier. I want to provide an update on what we’re doing and guidance on steps that users and developers can take to be safe, even if your device is not yet running Lollipop.

Keeping software up to date is one of the greatest challenges in security. Google invests heavily in making sure Android and Chrome are as safe as possible and doing so requires that they be updated very frequently. With Google’s assistance, Android device manufacturers (OEMs) have been moving rapidly to improve the rate that devices are updated and to ship devices with the most recent versions of Android. We provide patches for the current branch of Android in the Android Open Source Project (AOSP)[https://source.android.com/] and directly provide Android partners with patches for at least the last two major versions of the operating system.

Improving WebView and browser security is one of the areas where we’ve made the greatest progress. Android 4.4 (KitKat) allows OEMs to quickly deliver binary updates of WebView provided by Google, and in Android 5.0 (Lollipop), Google delivers these updates directly via Google Play, so OEMs won’t need to do anything. Until recently we have also provided backports for the version of WebKit that is used by Webview on Android 4.3 and earlier. But WebKit alone is over 5 million lines of code and hundreds of developers are adding thousands of new commits every month, so in some instances applying vulnerability patches to a 2+ year old branch of WebKit required changes to significant portions of the code and was no longer practical to do safely. With the advances in Android 4.4, the number of users that are potentially affected by legacy WebKit security issues is shrinking every day as more and more people upgrade or get new devices.

There are also steps users and developers can take to mitigate the risk of potential exploitation of WebKit vulnerabilities without updating to Lollipop. Using a browser that is updated through Google Play and using applications that follow security best practices by only loading content from trusted sources into WebView will help protect users.

When browsing on any platform, you should make sure to use a browser that provides its own content renderer and is regularly updated. For instance on Android, Chrome [http://goo.gl/elSkZX] or Firefox [http://goo.gl/Q5X6e3] are both great options since they are securely updated through Google Play often: Chrome is supported on Android 4.0 and greater, Firefox supports Android 2.3 and greater. Chrome has been the default browser for all Nexus and Google Play edition devices since 2012 and is pre-installed on many other popular devices (including Galaxy devices from Samsung, the G series from LG, the HTC One series, and the Motorola X and G), so you may already be using it.

Using an updatable browser will protect you from currently known security issues, and since it can be updated in the future it will also protect you against any issues that might be found in the future. It will also allow you to take advantage of new features and capabilities that are being introduced to these browsers.

If you are an application developer, there are also steps you should take to keep users safe. Application developers should make sure that they are following all security best practices[http://goo.gl/b6a3ta]. In particular, to resolve this issue when using WebView[http://goo.gl/FKeouw], developers should confirm that only trusted content (e.g. loaded from a local source or over HTTPS) is displayed within WebViews in their application. For maximum security when rendering content from the open web, consider providing your own renderer on Android 4.3 and earlier so that you can keep it up to date with the latest security patches.





رسماً در متن پستی که منتشر کرده اورده که توسعه دهندگان بهتر هستش که از مرورگرها استفاده کنند. و قبل تر از اون اورده که امکان به روزرسانی webview بسیار مشکل هستش.



لینک اصلی شخص Adrian Ludwig :

https://plus.google.com/+AdrianLudwig/posts

smemamian
جمعه 10 بهمن 1393, 23:34 عصر
سلام
من یه خبری دیدم چند وقت پیش که انگاری قراره مثل Google Play Service (البته دقیق نمیدونم که اینم از سیستم عامل جدا شده یا کلا از اول جدا بوده) جدا بشه از سیستم عامل و بروزرسانی هاش مثل این برنامه باشه، منظورتون همینه یا یه چیز دیگه؟

این جمله سبز رنگ رو میشه کمی باز کنید : )

نه.


مرگ نرم افزار، تغییرات است.


متاسفانه بیشتر برنامه نویس ها/توسعه دهندگان وقتی یک پروژه ای رو قبول می کنند بیشتر به فکر پایان رساندن اون پروژه هستند و به این نکته دقت نمی کنند که باید در ابتدا به فکر یک چهارچوبی در نرم افزار باشند که در آینده با مشکل روبرو نشوند. خیلی از توابع/کلاس ها/کتابخانه ها مشکل بیشتر برنامه نویس ها/توسعه دهندگان رو برطرف می کنند ولی خیلی از همین توابع وقتی در یک پروژه واقعی استفاده می شوند، خیلی از قسمت های دیگر پروژه وابسته به این توابع/کلاس ها/کتابخانه ها می شوند که عملاً تغییرات اون ها اگر مستندات فنی نرم افزار (قسمت های Comment در داخل نرم افزار یا مستندات خارج از نرم افزار)، مهیا نباشه عملاً تغییرات نرم افزار کم کم نرم افزار رو روبه نزول خواهد برد.
برای مثال، خیلی از دوستان از کتابخانه ای برای اینکه در نسخه های پایین اندروید، فارسی رو پوشش دهند استفاده می کنند. ولی آیا لازمه نرم افزار حتماً نسخه پایین رو پوشش دهد ؟

تغییرات کوچکی که برنامه نویس ها/توسعه دهندگان برای اعمال نیازمندی های شرکت/سازمان/کاربران در طول نسخه های مختلف می دهند، کم کم برنامه رو به جایی می رساند که تغییرات جدید نیازمند وقت و هزینه های بیشتر هست که عملاً در رقابت های بین سازمانی/شرکتی زمان از هزینه مهم تر می باشد.

روش های مختلفی برای رفع این مشکلات وجود داره به صورت خلاصه :

- نیازمندی های فعلی و آینده سازمان/شرکت/کاربر چه هستند ؟
- مخاطب نهایی شما کیست ؟
- فال گوش به فناوری ها و تغییرات جدید باشید. (توضیحات: طراحی Material Design یکی از موفق ترین طراحی ها خواهد بود. الان در پروژه های بزرگ که قبل تر از این طراحی نوشته شدن اگر برنامه ریزی درستی در این راستا نکرده باشند مطمئناً زمان زیادی برای طراحی جدید باید صرف کنند. خیلی از نرم افزارهای قبل از این طراحی از کتابخانه های آماده و مختلف برای نمایش Toast,Dialog و.. استفاده می کردند و الان حذف اون کتابخانه ها و ایجاد طراحی Material Design بسیار مشکل خواهد بود. )
- پیش بینی کنید.
- با کارفرما یا بخش فنی یک شرکت/سازمان زیاد در ارتباط باشید و سعی کنید از چهارچوب های شرکت/سازمان مطلع باشید.
- به فکر اکثریت کاربرها باشید نه تمامی کاربران.

موفق و پایدار