Is it possible to clear the android application cache at API 21 - java

Is it possible to write a function to clear the app cache on my app. I know that I can go to app settings and clear it that way but I want to be able to do that within my own app in code when its finished processing.
Any suggestions would be greatly appreciated.
I have tried Clear Cache in Android Application programmatically but the app still shows that the cache is not cleared.
I have also looked at How to delete app cache for all apps in Android M? but have not been able to write something to do this.
I have added <permission android:name="android.permission.CLEAR_APP_CACHE"/>to the manifest but this does not seem to make any difference.

Related

How to prevent Admob ad ids from leaked by android hackig app

I have developed an android app. All the things are working fine but the main problem is, using the Hack App Data anyone can see the ad codes which is a very dangerous threat.
Now how can i prevent hack app to open my application or edit my application data or how can i prevent hack app data to access this sensitive information?
note: I have turned off android:exported="false" and also add <permission android:protectionLevel="signature"
android:name="apricot.com.newshunt"/> to my menifest file
you can set the Copy Protection to On in the Android Market upload page. It's near the bottom. I doubt it is fool-proof but it can help keep some of the people likely to do this from being able to.
You should add the view in Java instead of XML and obfuscate your code.

How to make a system app in Android code

I'm trying to make a app that works like a parental control, but doing so, I got stuck in system app permissions, looking about it, I am not able to find anything that tells me that it is possible to do without using a specific ROM for my app. But in the Play Store, has a lot of apps that makes that. In my app, every time that I try to block connectivity, using ConnectivityManager, he gives me:
java.lang.SecurityException: Neither user 10228 nor current process has android.permission.MODIFY_PHONE_STATE.
And the permission is in the manifest. In the manifest, he gives me the error:
Permission is only granted to system apps.
So, I'm asking, how to make a system App in Android code without root the device?
how to make a app that it is a system app in Android code without root the device?
The closest thing to what you describe is for you to create your own custom Android ROM, where your app is pre-packaged as a system app, and convince people to install your ROM on their device, replacing their existing Android installation.
Otherwise, this is not possible. This should be obvious: if everyone could write an app that made themselves be a system app, there would be no value in having a distinction between regular apps and system apps.

Making an FPS counter for an Android app (having the .apk only)

I want to make an FPS counter for Android apps. While doing research I found a lot of examples for doing this when you have access to the source code of the app, since the counting is done in the main drawing loop.
The problem is I don't have the source code, I have only the .apk of the app so there is no way to modify it. My question is, how could this be done? (at least an idea to start with). And I am sure it can be done somehow, I've seen an app like this on Google Play.
Thanks!
I just installed the app.
At the beginning they ask for the activation of USB debugging on the device. And this why it needs a connection to the PC.
So this is how they are able to get such kind of information.
I would advise you to look at USB debugging of Android apps and see what is possible there (such as taking multiple screenshots per second)

AdMob SDK on Android: multiple SCHTimer Threads after showing Ads

I am using Google AdMob for showing Ads in an application of mine. Everything is working fine, unless that the number of Threads add up over time. My application will get more and more DaemonThreads named "SCHTimer" that are created internally by AdMob.
It is the same problem as this guy has: https://groups.google.com/forum/#!msg/google-admob-ads-sdk/EvfESpBSjbY/DEyCfxP4hxcJ
Unfortunately, there is no answer to it on the forum. My AdMob initializion/destroying looks very similar. After debugging with several breakpoints, I can verify that the destroy part gets called.
Also I couldn't find any indication of leaking objects in the HPROF profile.
Therefore, I am running out of ideas, what else to look for. Did anyone else experience this problem? (How) Did you solve it?

Getting facebook deeplinks to work on emulator facebook android

The problem I'm trying to solve- I'm trying to get deep linking working, and testing it with Emulator. When clicking on posts, the links direct to the mobile web site. This is in the case of the user having permissions for the app, and the app is installed (on the emulator). In the Facebook app, it even acknowledges its out of date, but an upgrade (in app) crashes.
I also noticed that the Facebook app installed on the emulator is out of date (I installed it via adb install facebook.apk from github sdk).
SSO is working fine, and I have setup deeplinking effectively with iOS before (So I know how ti's supposed to work/test it, etc.). But the port to Android is being held back by this out of date 3rd party Facebook app. I'm assuming testing on device will solve it, because there the Facebook app will be the latest (which brings to mind- what if people haven't updated their android facebook app?).
My app settings:
I'd post code, but this seems to be pure integration and configuration issues.
Note: my app isn't published on Google Play, could that be the issue?
Also: maybe this is only testable on the device? My device is "in the mail" so trying to get this done with emulator as much as i can.
Update: Facebook told me that this requires the Facebook app 1.9.* which is not in the SDK. So, I got my hands on a device, and while I haven't solved it, at least the app bookmark functionality is working. Will update if/when I find the answer.
Update 11am: I finally got it to work!
I had to publish my app in the Play/Market.
Each time I tested, log out of FB-Android app, clear cache, and force stop. Acc.
to the documentation the bookmarks are cached. I also think the
facebook app-syncing occurs on launch, and never again. So if you
change anything in FB's app settings, you need to log out/clear
cache/stop for it to take in the fb android app.
Only one key worked, even though it says "hash" in the fb app settings, I think
my dev key was screwing things up. Double-confirm that your release
key is the same as the one listed in app settings.
The final secret sauce for me, was to turn off SSO and deeplinking, re-test
without anything set. Also, remove dev package from phone and
download from Play. (see: key mixups). then, I stepped back through
the configurations by first turning on SSO, testing, then turning on
the native deep linking.
Only works on real device, not emulator (unless you can get 1.9 installed on emulator, may work, did not go down that route to test)
Not sure if this matters, but it may: install app from Store/Play, not from Eclipse. Could be the key syncing thing.
I figured it out- involved doing the following:
I had to publish my app in the Play/Market.
Each time I tested, log out of FB-Android app, clear cache, and force stop. Acc. to the documentation the bookmarks are cached. I also think the facebook app-syncing occurs on launch, and never again. So if you change anything in FB's app settings, you need to log out/clear cache/stop for it to take in the fb android app.
Only one key worked, even though it says "hash" in the fb app settings, I think my dev key was screwing things up. Double-confirm that your release key is the same as the one listed in app settings.
The final secret sauce for me, was to turn off SSO and deeplinking, re-test without anything set. Also, remove dev package from phone and download from Play. (see: key mixups). then, I stepped back through the configurations by first turning on SSO, testing, then turning on the native deep linking.
Only works on real device, not emulator (unless you can get 1.9 installed on emulator, may work, did not go down that route to test)
Not sure if this matters, but it may: install app from Store/Play, not from Eclipse. Could be the key syncing thing.
Have you had a look at the troubleshooting tips for deep linking? (Sorry, have to ask.)
I'm wondering if perhaps the FB app on your device was not properly quit after the relevant setting changes.

Categories

Resources