Alejandro Emanuel
Alejandro Emanuel

Reputation: 11

Xamarin does not delete data from a table

I am developing an app in Xamarin. I delete the data from the app in SQLite and uninstall it, but when I reinstall it, the data in the tables is still there.

public void DeleteCompras()
        {
            _database.DropTableAsync<CompraMetales>().Wait();
            _database.CreateTableAsync<CompraMetales>().Wait();
            _database.DeleteAllAsync<CompraMetales>().Wait();
        }

Thanks!

Upvotes: 0

Views: 92

Answers (1)

Artem Tishchenko
Artem Tishchenko

Reputation: 330

You need disable all debug optimisation, also add that flags into android manifest file:

<application android:label="@string/app_name" android:icon="@drawable/iii" android:largeHeap="true" android:allowBackup="false" android:allowClearUserData="true">

Also try replace ypur code

public async void DeleteCompras()
{
    await _database.DropTableAsync<CompraMetales>();
    await _database.CreateTableAsync<CompraMetales>();
    await _database.DeleteAllAsync<CompraMetales>();
}

Upvotes: 1

Related Questions