Rollback Update OTA SDK

I developed an SDK for android applications. We have many clients using this SDK where there are applications. Now I have updated my SDK. I am looking for a way in which these changes can reflect the application there without updating the application there in the store.Urgent game need help. Any help would be appreciated. Thanks in advance.

+7
android sdk android-sdk-tools
source share
2 answers

Well, you can dynamically load the jar file from the SD card using the DexLoader class ... which you can update whenever you want ... on your storage ... below is the working code.

final String libPath = Environment.getExternalStorageDirectory() + "/test.jar"; final File tmpDir = getDir("dex", 0); final DexClassLoader classloader = new DexClassLoader(libPath, tmpDir.getAbsolutePath(), null, this.getClass().getClassLoader()); final Class<Object> classToLoad = (Class<Object>) classloader.loadClass("com.test.android.MainActivity"); final Object myInstance = classToLoad.newInstance(); final Method doSomething = classToLoad.getMethod("doSomething"); doSomething.invoke(myInstance); 

and in your file library file might be like

 public class MainActivity { public void doSomething() { Log.e(MainActivity .class.getName(), "MainActivity : doSomething() called."); }} 

tell me if you need help

+4
source share

there is no such way for your situation. But there is one thing you can do to enable it for the next update. Android can dynamically load compiled code from DexClassLoader . So, you compile a new DEX file and then force your SDK to download and use it.

 // Internal storage where the DexClassLoader writes the optimized dex file to final File optimizedDexOutputPath = getDir("outdex", Context.MODE_PRIVATE); DexClassLoader cl = new DexClassLoader(dexInternalStoragePath.getAbsolutePath(), optimizedDexOutputPath.getAbsolutePath(), null, getClassLoader()); Class libProviderClazz = null; try { // Load the library. libProviderClazz = cl.loadClass("com.example.dex.lib.LibraryProvider"); // Cast the return object to the library interface so that the // caller can directly invoke methods in the interface. // Alternatively, the caller can invoke methods through reflection, // which is more verbose. LibraryInterface lib = (LibraryInterface) libProviderClazz.newInstance(); lib.showAwesomeToast(this, "hello"); } catch (Exception e) { ... } 
+1
source share

All Articles