akhilkedia / AllTrans

Completely Translate Android apps in-place aka Google translate in Chrome
Other
385 stars 32 forks source link

Need Help Regarding Sharepreference #24

Closed Android1500 closed 3 years ago

Android1500 commented 3 years ago

Actually i m making a module which have its data on preference.xml but as we knw we cant read sharepreference in above sdk 23 so any soloution for this i really appericate if you coul help me

akhilkedia commented 3 years ago

Hello.

I use a ContentProvider to get around this issue.

The hooked app asks for the preferences from the AllTrans app using a standard Android Content Resolver at https://github.com/akhilkedia/AllTrans/blob/4b40b6827a335dc3c51809a688736f4d07d09c3d/app/src/main/java/akhil/alltrans/AttachBaseContextHookHandler.java#L70

The AllTrans app has a Content Provider at https://github.com/akhilkedia/AllTrans/blob/master/app/src/main/java/akhil/alltrans/sharedPrefProvider.java

I saw this code in some other modules, and used the same.

Android1500 commented 3 years ago

Hello.

I use a ContentProvider to get around this issue.

The hooked app asks for the preferences from the AllTrans app using a standard Android Content Resolver at https://github.com/akhilkedia/AllTrans/blob/4b40b6827a335dc3c51809a688736f4d07d09c3d/app/src/main/java/akhil/alltrans/AttachBaseContextHookHandler.java#L70

The AllTrans app has a Content Provider at https://github.com/akhilkedia/AllTrans/blob/master/app/src/main/java/akhil/alltrans/sharedPrefProvider.java

I saw this code in some other modules, and used the same.

Thanks for your fix but i solved it by just change target api 23 pretty simple