D
D
Dmitry Filippov2016-03-08 15:19:10
HTTP Cookies
Dmitry Filippov, 2016-03-08 15:19:10

Can't connect cordova-cookie-master plugin to Apache Cordova in MS VS 2015, what should I do?

I think that many who made applications on Cordova know that this thing does not know how to work with cookies. You run it in a browser - everything is perfect, you run it on a device - if you please, go to npmjs.com for a plugin. I found the necessary plugin, but MS Visual Studio 2015 does not want to accept it. It says "Visual Studio could not parse the plugin.xml file. Make sure the plugin.xml file exists and is free of errors." Cordova-cookie-master plugin, found it on NPM.
0EISaE_Mnxw.jpg
Plugin is here . Here's another git .
I even tried to download the plugin itself from github and install it locally, but the result is the same. Good people, do you have any thoughts on this issue?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Filippov, 2016-03-09
@HorrorInferno

In general, I solved the problem myself, without extraneous plugins. To enable cookies:
1) Go to /platforms/android/src/ru/youdomain/yourapp/
2) Open MainActivity.java in any text editor
3) Fix this code:

package ru.youdomain.yourapp;

import android.os.Bundle;
import org.apache.cordova.*;

public class MainActivity extends CordovaActivity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        // Set by <content src="index.html" /> in config.xml
        loadUrl(launchUrl);
    }
}

Here on this one:
package ru.youdomain.yourapp;

import android.os.Bundle;
import android.webkit.CookieManager;
import org.apache.cordova.*;

public class MainActivity extends CordovaActivity
{
    @Override
    public void onCreate(Bundle savedInstanceState)
    {
    CookieManager.setAcceptFileSchemeCookies(true);
        super.onCreate(savedInstanceState);
        // Set by <content src="index.html" /> in config.xml
        loadUrl(launchUrl);
    }
}

4) We rejoice at the included cookies :)
That is, in fact, I just added two lines that allow us to use cookies.
Use on health!

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question