java - How to access Sqllite DB installed in android from web portal through USB -


we have android app , web portal developed in java client, sqllite db installed in android app. want offline sync, in order connecting android device pc through usb. possible access sqllite db installed in android device web portal?

i appreciate answer.

i dont think can directly access usb database stored in apllications private memory not in sdcard,but can export database via code in app (just viewing purpose) , upload file server

public class exportdb {    final static string sample_db_name = "yourdatabase";    public static void exportdb(context context){         file sd = environment.getexternalstoragedirectory();         file data = environment.getdatadirectory();         filechannel source=null;         filechannel destination=null;         string currentdbpath = "/data/"+ "your.package.name" +"/databases/"+sample_db_name;         string backupdbpath = sample_db_name;         file currentdb = new file(data, currentdbpath);         file backupdb = new file(sd, backupdbpath);         try {             source = new fileinputstream(currentdb).getchannel();             destination = new fileoutputstream(backupdb).getchannel();             destination.transferfrom(source, 0, source.size());             source.close();             destination.close();             toast.maketext(context, "db exported!", toast.length_long).show();         } catch(ioexception e) {             e.printstacktrace();         }     } } 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -