Parse for Unity crash in Windows Phone - windows-phone-8

I've finished a Unity game which i want to publish in Google Play, Windows Phone Store and Windows 8 Store. I'm using the very last version of Parse for Unity SDK (1.4.1) and also the last version of Unity Editor (4.6.4p4), including last patches.
The Parse implementation i made in my game works perfectly on:
- Unity Editor (all platforms)
- Android (deploying apk on two devices)
- Android (Publishing the game as alpha, installing it in +8 devices)
- Windows Phone 8 (All Windows Phone Emulators - 8.0 and 8.1 - x86)
- Windows Phone 8 (debugging on device with both Visual Studio 2012 for Windows Phone and Visual Studio 2013 Community - ARM)
It does'nt work on:
- Windows Phone 8 (deploying as a Beta)
- Windows Phone 8 (deploying as Hidden release)
The game crashes every time i try to use any function of the Parse SDK, throws no exception, the Windows Phone 8 Store gives me no info about any crashes... seems like an assembly load issue...
I've no idea what is happening, this issue is stoping me to publishing my game, think i'm going crazy...
So, i've made a simple dummy app to test my parse implementation, and... it has the same issue... it's very simple: Only a gameobject which has the "Parse Initialize Behaviour" attached (with both AppId and .NET keys setted) and a very simple script:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using System.Xml;
using System.IO;
using System.Text;
using System;
using System.Linq;
using Parse;
using System.Threading.Tasks;
// Demo application script
public class AppScript : MonoBehaviour
{
public static string userName = "Caldofran";
public static string userPass = "Password5";
public static string userEmail = "caldofran#email.com";
public static string errAsincrono = "";
public static string log = "";
public static bool bLogin = false;
public static bool bSignUp = false;
// Use this for initialization
void Start () {
//Application.runInBackground = true;
}
GUIStyle ts = new GUIStyle();
void OnGUI()
{
if (GUI.Button(new Rect(10, 100, 100, 30), "Sign Up"))
SignUp(userName,userPass, userEmail);
if (GUI.Button(new Rect(10, 150, 100, 30), "Login"))
Login(userName, userPass);
if (GUI.Button(new Rect(10, 200, 100, 30), "Logout"))
Logout();
if (GUI.Button(new Rect(10, 300, 100, 30), "Clear Texts"))
{
errAsincrono = "";
log = "";
}
int left = Screen.width - 110;
string usrParse = "";
if (AppScript.IsLoggedInParse())
usrParse = ParseUser.CurrentUser.Username;
ts.normal.textColor = Color.red;
GUI.BeginGroup(new Rect(300, 5, 600, 500));
GUI.Box(new Rect(0, 0, 400, 300), "");
//GUILayout.Label("P: " + mensajeGUI);
GUILayout.Label("User Config: " + userName, ts);
GUILayout.Label("Pass config: " + userPass, ts);
GUILayout.Label("email config: " + userEmail, ts);
GUILayout.Label("Logged in parse: " + AppScript.IsLoggedInParse().ToString(), ts);
GUILayout.Label("Parse logged user: " + usrParse, ts);
GUILayout.Label("Last msg: " + errAsincrono, ts);
GUILayout.Label("Last Log: " + log, ts);
GUI.EndGroup();
}
// Update is called once per frame
void Update () {
if (bLogin)
{
bLogin = false;
log += " Login Update text";
}
if (bSignUp)
{
bSignUp = false;
log += " SignUp Update text";
}
}
#region Parse
public static bool IsLoggedInParse()
{
bool retorno = false;
if ((ParseUser.CurrentUser != null) && (ParseUser.CurrentUser.IsAuthenticated))
retorno = true;
return retorno;
}
public static void SignUp(string userName, string passWord, string email)
{
var user = new ParseUser()
{
Username = userName,
Password = passWord
};
if (string.IsNullOrEmpty(email))
user.Email = "";
else
user.Email = email;
try
{
Task signUpTask = user.SignUpAsync().ContinueWith(t=>
{
if (t.IsFaulted || t.IsCanceled)
{
// The login failed. Check the error to see why.
foreach(var e in t.Exception.InnerExceptions) {
ParseException parseException = (ParseException) e;
log += parseException.Message + ": CODE: " + parseException.Code.ToString();
}
errAsincrono = t.Exception.Message;
}
else
{
// Signup was successful.
log = "Welcome " + userName;
bSignUp = true;
}
});
}
catch (Exception ex)
{
errAsincrono = "Error: " + ex.Message;
}
}
public static void Login(string user, string pass)
{
try
{
ParseUser.LogInAsync(user, pass).ContinueWith(t =>
{
if (t.IsFaulted || t.IsCanceled)
{
// The login failed. Check the error to see why.
foreach(var e in t.Exception.InnerExceptions) {
ParseException parseException = (ParseException) e;
log += parseException.Message + ": CODE: " + parseException.Code.ToString();
}
errAsincrono = t.Exception.Message;
}
else
{
// Login was successful.
log = "Welcome back " + userName;
AppScript.bLogin = true;
}
});
}
catch (Exception ex)
{
errAsincrono = "Error: " + ex.Message;
}
}
public static void ResetPassword(string email)
{
if (IsLoggedInParse())
{
Task requestPasswordTask = ParseUser.RequestPasswordResetAsync(email);
log = "Pass reset ok";
}
}
public static void Logout()
{
if (IsLoggedInParse())
{
ParseUser.LogOutAsync();
log = "Logged out ";
}
}
#endregion
}
Can anybody try it? What i'm doing wrong? Why this code works nearly always but not in Windows Phone (published on the store)?
I've read about Unity bug, which affects only to iOS: http://forum.unity3d.com/threads/unity-5-parse-ios-nsurlerrordomain-error-1012.308569/
This bug (consuming WWW trough SSL) affects Windows Phone apps?

In my case, using Parse SDK 1.6.1 for Windows.
To set Password property throws ArgumentException.
The cause was in Master build configuration and .NET Native tool chain.
Solution 1:
Uncheck "Compile with .NET Native tool chain" in Project's Build settings.
Solution 2:
Create subclass of ParseUser and define "new" properties Username and Password.

Related

Printing server report without preview showing up zoomed report

I'm trying to print a server report without preview using C#. The report is printing fine in WidowsXP but it's printing in zoomed view in Windows 7 and Windows 10. Below is my code.
using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Printing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Microsoft.Reporting.WinForms;
namespace Dahlawi.ManPower.Recruiting.Forms
{
public partial class FrmReportViewer1 : Form
{
List<Metafile> m_ReportPages = new List<Metafile>();
int m_ReportPageIndex = 0;
public FrmReportViewer1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
PrintDocument objPrintDoc = new PrintDocument();
objPrintDoc.PrintPage += PrintPageHandler;
PrintDialog objPrintDiag = new PrintDialog();
objPrintDiag.Document = objPrintDoc;
DialogResult objDiagResult = default(DialogResult);
objDiagResult = objPrintDiag.ShowDialog();
if (objDiagResult == DialogResult.OK)
{
objPrintDoc.PrinterSettings = objPrintDiag.PrinterSettings;
this.m_ReportPages = new List<Metafile>();
this.m_ReportPageIndex = 0;
this.reportViewer.ShowCredentialPrompts = false;
this.reportViewer.ServerReport.ReportServerCredentials.NetworkCredentials = new System.Net.NetworkCredential("USER", "PASSWORD", "DOMAIN");
this.reportViewer.ServerReport.ReportServerUrl = new Uri("http://SERVER/ReportServer");
this.reportViewer.ServerReport.ReportPath = "/DMR/Candidate_Information";
ReportParameter[] reportParameters = new ReportParameter[] { new ReportParameter("CandidateId", "16744") };
reportParameters[0].Visible = false;
this.reportViewer.ServerReport.SetParameters(reportParameters);
this.reportViewer.RefreshReport();
string deviceInfo = "<DeviceInfo>" + "<OutputFormat>emf</OutputFormat>" + " <PageWidth>8.5in</PageWidth>" + " <PageHeight>11in</PageHeight>" + " <MarginTop>0.2in</MarginTop>" + " <MarginLeft>0.5in</MarginLeft>" + " <MarginRight>0.5in</MarginRight>" + " <MarginBottom>0.2in</MarginBottom>" + "</DeviceInfo>";
Warning[] objWarnings = null;
string[] sStreamIDs = null;
string sMimeType = "";
string sEncoding = "";
string sFilenameExtension = "";
byte[] renderedPage = null;
renderedPage = this.reportViewer.ServerReport.Render("Image", deviceInfo, out sMimeType, out sEncoding, out sFilenameExtension, out sStreamIDs, out objWarnings);
this.m_ReportPages.Add(new Metafile(new MemoryStream(renderedPage)));
foreach (string sStreamId in sStreamIDs)
{
renderedPage = this.reportViewer.ServerReport.RenderStream("Image", sStreamId, deviceInfo, out sMimeType, out sEncoding);
this.m_ReportPages.Add(new Metafile(new MemoryStream(renderedPage)));
}
objPrintDoc.Print();
objPrintDoc = null;
}
}
private void PrintPageHandler(object sender, PrintPageEventArgs e)
{
if (this.m_ReportPageIndex < this.m_ReportPages.Count)
{
Metafile imgPage = this.m_ReportPages[this.m_ReportPageIndex];
this.m_ReportPageIndex += 1;
e.Graphics.DrawImage(imgPage, 0, 0, imgPage.Width, imgPage.Height);
e.HasMorePages = this.m_ReportPageIndex < this.m_ReportPages.Count;
}
}
}
}
When I print the report using above code in WindowsXP it prints like this Proper Print
But when I run the same code in Windows 7 or Windows 10 it prints like this Zoomed Print
Please help me run this code on Windows 7 / Windows 10. I can provide more details if required.
I found out the issue and it's the "emf" output format which is causing the problem on Windows 7 and Windows 10 but working fine on Windows XP / Windows 2003. I changed the output format in "deviceInfo" string from "emf" to "jpg" (other formats e.g. "png", "jpeg", "bmp" also work fine) and then I changed the type of "m_ReportPages" list object from "Metafile" to "Image" and got the issue resolved.

SMTP gmx server problam

Im tyring to send an email with my program to an gmx email. Every time I try to send the mail I get the same error message in my console.
What can be the solution for that?
The error message:
System.Net.Mail.SmtpException: SMTP server requiers secure connection or the client wasnt authenticated. server response was: authentication required.
in - System.Net.Mail.SendMailAsyncResult.End(IAsyncResult result)
in - System.Net.Mail.SmtpClient.SendMailCallback(IAsyncResult result)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
using System.Net.Mail;
using System.Net.Mime;
using System.Threading;
using System.ComponentModel;
namespace SMTP_Client
{
class Program
{
static bool mailSent = false;
private static void SendCompletedCallback(object sender, AsyncCompletedEventArgs e)
{
// Get the unique identifier for this asynchronous operation.
String token = (string)e.UserState;
if (e.Cancelled)
{
Console.WriteLine("[{0}] Send canceled.", token);
}
if (e.Error != null)
{
Console.WriteLine("[{0}] {1}", token, e.Error.ToString());
}
else
{
Console.WriteLine("Message sent.");
}
mailSent = true;
}
public static void Main(string[] args)
{
SmtpClient client = new SmtpClient("smtp.gmx.com",25);
MailAddress from = new MailAddress("example#project.com", "me " + (char)0xD8 + " you", System.Text.Encoding.UTF8);
MailAddress to = new MailAddress("example#gmx.com");
MailMessage message = new MailMessage(from, to);
message.Body = "The project has succeeded ";
message.Subject = "made it!";
client.SendCompleted += new SendCompletedEventHandler(SendCompletedCallback);
string userState = "test message2\n";
client.SendAsync(message, userState);
Console.WriteLine("Sending message... press c to cancel mail. Press any other key to exit.");
string answer = Console.ReadLine();
if (answer.StartsWith("c") && mailSent == false)
{
client.SendAsyncCancel();
}
message.Dispose();
Console.WriteLine("proccess ended.");
}
}
}

Multiple calls to MessageDialog cause crash under Windows Phone 8.1

I develop an Universal App that uses MVVM-Light. I call WebServices from the ViewModels, and I throw the exceptions encountered by the calls at the WebServices to the ViewModels: TimeOut, Wrong URL, Server Exception, ...
I have created a class "ExceptionsMsgHelper.cs" which centralizes the messages displayed for each of these exceptions through MessageDialog.
My HomePage is based on a Pivot that containing several datas: some WebServices are called asynchronously. I so meet a crash if I show an Exception in a MessageDialog through the class "ExceptionsMsgHelper.cs", whereas a previous Exception is also showed in another MessageDialog.
Here is a part of my original class:
public class ExceptionsMsgHelper
{
public async static void MsgboxWebserviceErrors(WebServiceErrorsException wseE, string errors)
{
Windows.UI.Popups.MessageDialog msgbox =
new Windows.UI.Popups.MessageDialog("The Websercice '" + wseE.WebService + "' has returned errors : \n" + errors,
"Unexpected data");
await msgbox.ShowAsync();
}
}
=> If I call twice the "msgbox.ShowAsync()", I get the "System.UnauthorizedAccessException" Exception: with message "Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))"
I've so looked for solutions in order to fix it:
use a "Dispatcter", like it is recommended here (WinRT - MessageDialog.ShowAsync will throw UnauthorizedAccessException in my custom class)
The code is:
public class ExceptionsMsgHelper
{
public async static void MsgboxWebserviceErrors(WebServiceErrorsException wseE, string errors)
{
Windows.UI.Popups.MessageDialog msgbox =
new Windows.UI.Popups.MessageDialog("The Websercice '" + wseE.WebService + "' has returned errors : \n" + errors,
"Unexpected data");
CoreDispatcher dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
{
await msgbox.ShowAsync();
});
}
}
=> But I always meet the same exception.
use a "IAsyncOperation" command to close the previous MessageDialog, like recommended here (MessageDialog ShowAsync throws accessdenied exception on second dialog)
With this code:
public class ExceptionsMsgHelper
{
private static IAsyncOperation<IUICommand> messageDialogCommand = null;
public async static Task<bool> ShowDialog(MessageDialog dlg)
{
// Close the previous one out
if (messageDialogCommand != null)
{
messageDialogCommand.Cancel();
messageDialogCommand = null;
}
messageDialogCommand = dlg.ShowAsync();
await messageDialogCommand;
return true;
}
public async static void MsgboxWebserviceErrors(WebServiceErrorsException wseE, string errors)
{
Windows.UI.Popups.MessageDialog msgbox =
new Windows.UI.Popups.MessageDialog("The Websercice '" + wseE.WebService + "' has returned errors : \n" + errors,
"Unexpected data");
CoreDispatcher dispatcher = CoreWindow.GetForCurrentThread().Dispatcher;
dispatcher.RunAsync(CoreDispatcherPriority.Normal, async () =>
{
await ShowDialog(msgbox);
});
}
}
=> But in this case too, I always get the same exception.
use an extension to queue up messagedialogs, like describing here (Multiple MessageDialog app crash)
The code is now:
public class ExceptionsMsgHelper
{
public async static void MsgboxWebserviceErrors(WebServiceErrorsException wseE, string errors)
{
Windows.UI.Popups.MessageDialog msgbox =
new Windows.UI.Popups.MessageDialog("The Websercice '" + wseE.WebService + "' has returned errors : \n" + errors,
"Unexpected data");
await MessageDialogExtensions.ShowAsyncQueue(msgbox);
}
}
public static class MessageDialogExtensions
{
private static TaskCompletionSource<MessageDialog> _currentDialogShowRequest;
public static async Task<IUICommand> ShowAsyncQueue(this MessageDialog dialog)
{
if (!Window.Current.Dispatcher.HasThreadAccess)
{
throw new InvalidOperationException("This method can only be invoked from UI thread.");
}
while (_currentDialogShowRequest != null)
{
await _currentDialogShowRequest.Task;
}
var request = _currentDialogShowRequest = new TaskCompletionSource<MessageDialog>();
var result = await dialog.ShowAsync();
_currentDialogShowRequest = null;
request.SetResult(dialog);
return result;
}
private static IAsyncOperation<IUICommand> messageDialogCommand = null;
public async static Task<bool> ShowDialog(this MessageDialog dlg)
{
// Close the previous one out
if (messageDialogCommand != null)
{
messageDialogCommand.Cancel();
messageDialogCommand = null;
}
messageDialogCommand = dlg.ShowAsync();
await messageDialogCommand;
return true;
}
#endregion
}
=> And this works for me.
But like says it's author, it's probably not the best solution:
Close existing dialog when you need to open a new one. This is the simplest option and possibly the best, although you risk cancelling a dialog that might be somehow important depending on what your dialogs are about.
Queue up dialogs so the old ones don't get dismissed, but the new ones show up after the old ones were dismissed. This one will make sure all dialogs are closed by the user, but that could be a problem if your app can somehow start showing hundreds of dialogs.
Only open a new one if there isn't one already displayed. Now this risks that a newer message is not shown, which sounds more problematic than the first option.
=> I would like to understand why I can't apply one the 2 first solutions that seems to be more adapted
Ofcourse you can't show 2 or more message dialog at the same time (windows phone limits). Moreover MesssageDialog on Windows Phone 8.1 has probably bug and can't be closed.
If closing previous dialog will be solution for you, try to use ContentDialog instead MessageDialog. Check my answer in this topic: Closing MessageDialog programatically in WP 8.1 RT
I think it solve your problem.

How to update data continuously in UI text box control using windows phone application

Im developing a small Tcp Client Socket application in windows phone. Actually i have a text box, in that whatever the data received from a TCP server, should update continuously in UI text box control.
while (val)
{
result = Receive();
Dispatcher.BeginInvoke((Action)(() =>
{
txtOutput.Text += result;
}));
}
Here in above code, method receive() will receive string data and should update in textbox control but it is not happening,no data is updating to it.
Can any one suggest, how can i resolve this.
Just telling you what i have been advised, "avoid Dispatcher, CoreDispatcher, etc. There are always better solutions."
Below is the piece of code worked for me for both wp8 and wp8.1 WinRT app,
IProgress<object> progress = new Progress<object>(_ => UpdateTicker());
Task.Run(async () =>
{
while (val)
{
progress.Report(null);
}
});
where UpdateTicker() method contains your instructions, in this case...
public void UpdateTicker()
{
result = Receive();
txtOutput.Text += result;
}
Hope this helps...
Thanks for everyone, who given a valuable response for my post.
Hi Nishchith,
I tried your code, but it dint works for me
Here is my logic used to update textbox continuously with data received from TCP server.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using PhoneApp3.Resources;
using System.Net.Sockets;
using System.Threading;
using System.Text;
using Windows.Phone.Networking;
using System.Threading.Tasks;
namespace PhoneApp3
{
public partial class MainPage : PhoneApplicationPage
{
Socket _socket = null;
static ManualResetEvent _clientDone = new ManualResetEvent(false);
const int TIMEOUT_MILLISECONDS = 1000;
const int MAX_BUFFER_SIZE = 2048;
const int ECHO_PORT = 9055; // The Echo protocol uses port 7 in this sample
const int QOTD_PORT = 49152; // The Quote of the Day (QOTD) protocol uses port 17 in this sample
string result = string.Empty;
public MainPage()
{
InitializeComponent();
}
private void btnEcho_Click(object sender, RoutedEventArgs e)
{
SocketClient client = new SocketClient();
Connect(txtRemoteHost.Text, ECHO_PORT);
//close();
}
public void Connect(string hostName, int portNumber)
{
DnsEndPoint hostEntry = new DnsEndPoint(hostName, portNumber);
_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs();
socketEventArg.RemoteEndPoint = hostEntry;
socketEventArg.Completed += new EventHandler<SocketAsyncEventArgs>(delegate(object s, SocketAsyncEventArgs e)
{
result = e.SocketError.ToString();
_clientDone.Set();
});
_clientDone.Reset();
Thread.Sleep(2000);
_socket.ConnectAsync(socketEventArg);
Thread.Sleep(5000);
_clientDone.WaitOne(TIMEOUT_MILLISECONDS);
bool val;
if (result == "Success")
{
val = true;
}
else
{
val = false;
}
IProgress<object> progress = new Progress<object>(_ => UpdateTicker());
Task.Run(async () =>
{
while (val)
{
progress.Report(null);
}
});
}
public void UpdateTicker()
{
result = Receive();
string[] strsplit = result.Split(' ');
txtOutput.Text = strsplit[1];
}
public string Receive()
{
string response = "Operation Timeout";
if (_socket != null)
{
SocketAsyncEventArgs socketEventArg = new SocketAsyncEventArgs();
socketEventArg.RemoteEndPoint = _socket.RemoteEndPoint;
socketEventArg.SetBuffer(new Byte[MAX_BUFFER_SIZE], 0, MAX_BUFFER_SIZE);
socketEventArg.Completed += new EventHandler<SocketAsyncEventArgs>(delegate(object s, SocketAsyncEventArgs e)
{
if (e.SocketError == SocketError.Success)
{
// Retrieve the data from the buffer
response = Encoding.UTF8.GetString(e.Buffer, e.Offset, e.BytesTransferred);
response = response.Trim('\0');
}
else
{
response = e.SocketError.ToString();
}
_clientDone.Set();
});
_clientDone.Reset();
Thread.Sleep(1000);
_socket.ReceiveAsync(socketEventArg);
Thread.Sleep(1000);
_clientDone.WaitOne(TIMEOUT_MILLISECONDS);
}
else
{
response = "Socket is not initialized";
}
return response;
}
public void Close()
{
if (_socket != null)
{
_socket.Close();
}
}
}
}

File download not working in Android using cordova-2.9.0

I am working on a hybird application and it seems very straightforward way to download a pdf file from server using HTML5 anchor download attribute and this is working exactly as expected using below code on desktop browsers.
Download
Challange: But when I am trying to run same code in my Hybird application, using cordova 2.9.0 , when debugging app on mobile; on clicking of Download nothing shows up and download does not start.
Am I missing something very basic here?
Please suggest.
This code is for Android platform.
First, open the file [appname].java in your platform folder:
appname\platforms\android\src\com\[appname]\app
Next, set downloadListener for the webview, right after super.init();
here is the complete code:
package com.[appname].app;
import android.os.Bundle;
import org.apache.cordova.*;
public class [appname] extends CordovaActivity
{
#Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
super.init();
super.appView.setDownloadListener(new android.webkit.DownloadListener() {
public void onDownloadStart(String url, String userAgent, String contentDisposition, String mimetype, long contentLength) {
android.util.Log.d("Logger","url : " + url + " userAgent: " + userAgent + " contentDisposition: " + contentDisposition + " mimeType: " + mimetype + " contentLength " + contentLength);
android.net.Uri source = android.net.Uri.parse(url);
// Make a new request
android.app.DownloadManager.Request request = new android.app.DownloadManager.Request(source);
// appears the same in Notification bar while downloading
String filename = getFilename(contentDisposition);
request.setDescription("This file will be saved in your downloads folder.");
request.setTitle(filename);
//add cookie on request header (for authenticated web app)
String cookieContent = getCookieFromAppCookieManager(source.getHost());
request.addRequestHeader("Cookie", cookieContent);
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) {
request.allowScanningByMediaScanner();
request.setNotificationVisibility(android.app.DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED);
}
// save the file in the "Downloads" folder of SDCARD
request.setDestinationInExternalPublicDir(android.os.Environment.DIRECTORY_DOWNLOADS, filename);
// get download service and enqueue file
android.app.DownloadManager manager = (android.app.DownloadManager) getSystemService(android.content.Context.DOWNLOAD_SERVICE);
manager.enqueue(request);
}
});
super.loadUrl(Config.getStartUrl());
//super.loadUrl("file:///android_asset/www/index.html");
};
public String getFilename(String contentDisposition){
String filename[] = contentDisposition.split("filename=");
return filename[1].replace("filename=", "").replace("\"", "").trim();
};
public String getCookieFromAppCookieManager(String url){
android.webkit.CookieManager cookieManager = android.webkit.CookieManager.getInstance();
if (cookieManager == null)
return null;
String rawCookieHeader = null;
// Extract Set-Cookie header value from Android app CookieManager for this URL
rawCookieHeader = cookieManager.getCookie(url);
if (rawCookieHeader == null)
return null;
return rawCookieHeader;
};
}